LemmyNet / lemmy

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

Support mastodon mentions/notifications #2971

Open db0 opened 1 year ago

db0 commented 1 year ago

Is your proposal related to a problem?

No

Describe the solution you'd like

When I write an existing username, lemmy automatically suggests converting it into a link using markdown.

In mastodon however, a username is automatically considered a link, even without the markdown. Not only that but that also sends a notification to the target user which they see in their notifications tab

I use this "mention" functionality to set up my mastodon bot to reply to specific keywords (example: https://hachyderm.io/@db0/110509415390647774)

Unfortunately this doesn't work via lemmy. by itself a username mention doesn't seem to send a notification. E.g. https://lemmy.fmhy.ml/comment/4675 > https://hachyderm.io/@db0@lemmy.fmhy.ml/110509397097066990

Markdown likewise makes a link, but doesn't initiate a mention altert, so my bot doesn't react.

Describe alternatives you've considered

I'd like the possibility to trigger mentions, in the same way allowed in mastodon. This will be very useful for bot operations

Additional context

No

dessalines commented 1 year ago

@Nutomic Are mastodon mentions supported?

quantenzitrone commented 1 year ago

yeah i was so confused by this, as i wanted to mention someone on mastodon, until i realized, that mentions are something mastodon-internal

Nutomic commented 1 year ago

Im not sure what you are doing. You need to post exact steps to reproduce, including where you write a comment and where you expect to see a notification. In any case Lemmy federates notifications in the exact same format as Mastodon.

$ curl -H 'Accept: application/activity+json' https://lemmy.fmhy.ml/comment/4675 | jq
"tag": [
{
"href": "https://lemmy.fmhy.ml/u/db0",
"name": "@db0@lemmy.fmhy.ml",
"type": "Mention"
},
{
"href": "https://sigmoid.social/users/stablehorde_generator",
"name": "@stablehorde_generator@sigmoid.social",
"type": "Mention"
}
],
$ curl -H 'Accept: application/activity+json' https://hachyderm.io/@db0/110509415390647774 | jq
"tag": [
{
"type": "Mention",
"href": "https://sigmoid.social/users/stablehorde_generator",
"name": "@stablehorde_generator@sigmoid.social"
},
{
"type": "Hashtag",
"href": "https://hachyderm.io/tags/nsfw",
"name": "#nsfw"
}
],

I assume this is a problem with Mastodon doing something weird internally.

db0 commented 1 year ago

I've managed to get the notifications to work on mastodon when sending them manually via the activitypub protocol, but the problem here I think is that your "name" value is incorrect. For me it only works with

"name": "@db0"

not with

"name":"@db0@hachyderm.io"

Nutomic commented 1 year ago

Looks like Mastodon sends both variants in different cases, not sure what the logic is. In any case "name":"@db0@hachyderm.io" is more specific so I would expect it to work more reliably. Can you check with the Mastodon devs about this?