Microblog (think Mastodon)−style attachments support merged into Lemmy (github.com)
from Aatube@kbin.melroy.org to fediverse@lemmy.world on 02 Nov 2024 21:14
https://kbin.melroy.org/m/fediverse@lemmy.world/t/543088

Append attachments to comments by flamingo-cant-draw ?? Pull Request #5143 ?? LemmyNet/lemmy

#5143 #fediverse #lemmy #mastodon

threaded - newest

Blaze@feddit.org on 02 Nov 2024 21:20 next collapse

Good news, well done @flamingos@feddit.uk

cabbage@piefed.social on 02 Nov 2024 21:41 next collapse

So when images are attached to comments from Mbin (without markdown), they will finally show up in Lemmy? Is that what this means?

KLISHDFSDF@lemmy.ml on 02 Nov 2024 21:45 next collapse

yeah, someone dumb it down for us plebs

Aatube@kbin.melroy.org on 02 Nov 2024 22:26 collapse

basically what cabbage said. same goes for mastodon posts in subs

DarkThoughts@fedia.io on 02 Nov 2024 22:42 next collapse

Speaking of which... When can we finally ctrl+v paste them in from our clipboard? :(

Aatube@kbin.melroy.org on 02 Nov 2024 22:47 collapse

speaking of which... when will the "upload from URL" button actually work‽
oh wait, they removed it?

...yay?

DarkThoughts@fedia.io on 03 Nov 2024 11:35 collapse

Upload from URL is pointless since you can just markdown that URL directly.

Aatube@kbin.melroy.org on 03 Nov 2024 12:21 collapse

i liek attachments moar

DarkThoughts@fedia.io on 03 Nov 2024 12:25 collapse

Even then pasting would also solve that issue since you can copy images from websites.

originalucifer@moist.catsweat.com on 02 Nov 2024 23:13 collapse

theres a manual fix for this. in mbin, when you attach the image in a post and save, it is uploaded and shown. you can then grab the image link (right click image, copy link), edit the post, and add the link using the image tag, and save, it then shows in-line in lemmy.

yeah, it sucks but at least it works until this is implemented. ive been usin this method for over a year now..

andrew_s@piefed.social on 02 Nov 2024 23:12 collapse

Do they work the other way around btw? If someone on Lemmy uses the Markdown for an inline image do they show up on MBIN? I don't they do on Mastodon.

Aatube@kbin.melroy.org on 02 Nov 2024 23:14 collapse

This PR doesn't add that, but anecdotally I'm fairly sure it already works for Mastodon... Not a Mastodon user, so I can't find any examples though. They definitely show on Mbin tho.

andrew_s@piefed.social on 03 Nov 2024 00:14 collapse

I just tried with Masto - maybe there's different versions, but it didn't work with the one I tried.

Screenshot:
<img alt="" src="https://i.postimg.cc/FKSy1Zh4/soup.jpg">

It's probably for the best that this PR doesn't also convert inline Markdown into an attachment to send out for Mastodon's benefit, because then there would be the danger of apps that understand both showing two images. It'd be better if Mastodon did the translation when receiving stuff, but Mastodon doesn't seem as good as MBIN when it comes to co-operating with Lemmy.

(edit: how that screenshot shows on MBIN is a bit disappointing though - at least looking at on the web)

flamingos@feddit.uk on 03 Nov 2024 00:34 collapse

This is Mastodon’s HTML sanitiser, you can see they stipe out <img> tags.

How does Piefed handle image attachments, btw?

andrew_s@piefed.social on 03 Nov 2024 01:14 collapse

How does Piefed handle image attachments, btw?

For comments: not at all. If a Mastodon user tried to do what I did, with the inline image, nothing would show.

We could do what I think you've done, and regex the details of the attachment into ! [] () Markdown and add it to the text. There's also a DB relationship between comments and images that isn't used, but could be, I suppose.

I've never actually seen a Mastodon user try to add an image to something that ended up as a Lemmy comment, tbh, so it's not something I've thought too much about.

flamingos@feddit.uk on 03 Nov 2024 03:25 collapse

We could do what I think you’ve done, and regex the details of the attachment into ! [] ()

To be clear, this pull request doesn’t use regex, it’s just JSON deserialisation and string interpolation.

I’ve never actually seen a Mastodon user try to add an image to something that ended up as a Lemmy comment, tbh, so it’s not something I’ve thought too much about.

The pull request actually includes one, the main KDE account tags !kde@lemmy.kde.social and includes pictures in their threads regularly. It’s just hard to tell from our side as you can’t see what’s missing.

andrew_s@piefed.social on 03 Nov 2024 06:36 collapse

Ah, great, thank you. It's been added as an Issue for PF now, with a link to this post, so that'll be handy.

(I was likely misusing the term 'regex').