LemmyNet / lemmy

🐀 A link aggregator and forum for the fediverse
https://join-lemmy.org
GNU Affero General Public License v3.0
13.12k stars 865 forks source link

Support attachment field in Notes #2456

Open utzer opened 1 year ago

utzer commented 1 year ago

For front end issues, use lemmy-ui I am honestly not sure if this is just a UI problem, I guess not.

Issue Summary

A picture in a comment written on Friendica will not be displayed on Lemmy.

Steps to Reproduce

  1. Comment on a Lemmy thread from Friendica and include a picture.
  2. Check the new comment on Lemmy, it will not include the picture, but the same comment will show the picture in Mastodon.

A comment on the same thread from Lemmy with a picture will show with the picture in Friendica.

Example: https://social.yl.ms/display/e18176ef-4963-31b6-da59-186672353229

Nutomic commented 1 year ago

Friendica federates the image in attachment field of Note, which Lemmy doesnt support.

"attachment": [
    {
        "type": "Document",
        "mediaType": "image/jpeg",
        "url": "https://social.yl.ms/photo/1103788203632f774882edd517821830-0.jpg",
        "name": null,
        "height": 2304,
        "width": 3072,
        "image": "https://social.yl.ms/photo/1103788203632f774882edd517821830-1.jpg"
    }
],
utzer commented 1 year ago

Thanks, yes then it is a feature request I guess.

dessalines commented 1 year ago

I'm trying to think how this would work with lemmy. I'm guessing we'd need to add attachment_post and attachment_comment tables, and have those come back with the API.

xundeenergie commented 1 year ago

Also posting a new post with pic fails from friendica. Not only comments.

Nutomic commented 1 year ago

We already use attachment field for posts, this is how the post url is federated (though we dont support type: Document for now, and anyway it should probably be type: Image in that case.

Not sure how it could work for comments, I suppose we could make a hack and insert ![](image-link) at the end of comment text? Tbh, I dont think its possible for a project to support everything thats valid Activitypub, so we could also consider closing this as wontfix.

Also posting a new post with pic fails from friendica. Not only comments.

Please show an example.

utzer commented 1 year ago

Please show an example.

Friendica https://social.yl.ms/display/e18176ef-9463-32c2-7a25-b29583096864

It does not arrive on Feddit for some reason. Maybe the photo?

Please don't close the issue just now, someone will have an idea how to implement this, other platforms also manage to handle pictures in comments.

Nutomic commented 1 year ago

Friendica https://social.yl.ms/display/e18176ef-9463-32c2-7a25-b29583096864

It does not arrive on Feddit for some reason. Maybe the photo?

Its because Friendica sends the attachment as type: Document, instead of type: Image which Lemmy supports. @annando is there any particular reason for this?

annando commented 1 year ago

The reason is - like always - compatibility. It seems as if most systems are doing so.

dessalines commented 1 year ago

Not sure how it could work for comments, I suppose we could make a hack and insert at the end of comment text? Tbh, I dont think its possible for a project to support everything thats valid Activitypub, so we could also consider closing this as wontfix.

That sounds like a good way to handle incoming attachments to me. Maybe even just do []() because technically an attachment doesn't have to be an image, I think.

xundeenergie commented 1 year ago

Is there no way, to detect the atrachment-mimetype? file on linux gives you the type.

So decide on the attachment, igf it is sent as image or document. Are there other types of attachments in ActivityPub?

xundeenergie commented 1 year ago

And, if it is no image... let the user download the attachment, and not discard the whole posting/comment

annando commented 1 year ago

@xundeenergie with the link to the document you also transmit the content-type.

xundeenergie commented 1 year ago

@xundeenergie with the link to the document you also transmit the content-type.

Now i understand... :man_dancing: