Skip to content

ForceMentionsInContent: fix double mentions for Mastodon/Misskey posts

Zero requested to merge zero/pleroma:double_mentions into develop

Checklist

  • Adding a changelog: In the changelog.d directory, create a file named <code>.<type>.

This one stumped me for a bit, I kept seeing double mentions from Mastodon and sometimes Misskey.
After I added a bunch of Logger statements and let it print data for a bit, I realized why it was happening.

The code was checking for api_id to not add duplicated mentions, but in those they look like that:
Mastodon: https://mastodon.example.com/users/roger
Misskey: https:///misskey.example.com/users/104ab42f11

So it was never going to match.
My fix was to also check the uri, because that matches the mention format from Mastodon and Misskey.
Mastodon: https://mastodon.example.com/@roger
Misskey: https://misskey.example.com/@roger

Merge request reports