diff options
author | Zero <zero@cock.li> | 2023-05-25 12:36:05 -0400 |
---|---|---|
committer | Zero <zero@cock.li> | 2023-05-26 12:30:19 -0400 |
commit | 279fd47b486ccfda4537d7a64d553ac261a6fdd8 (patch) | |
tree | 7fb9b899ec0191aec7ae1a1b0330711208ade6d3 /lib | |
parent | 5433742faf0acfe759799c1b7907b1aff44ecaf3 (diff) | |
download | pleroma-279fd47b486ccfda4537d7a64d553ac261a6fdd8.tar.gz pleroma-279fd47b486ccfda4537d7a64d553ac261a6fdd8.zip |
ForceMentionsInContent: fix double mentions for Mastodon/Misskey posts
The code checked for duplicates using "ap_id", but in Mastodon and Misskey the look like that:
Mastodon: https://mastodon.example.com/users/roger
Misskey: https:///misskey.example.com/users/104ab42f11
The fix is to also check for "uri", which is what will be in the "explicitly_mentioned_uris" list:
Mastodon: https://mastodon.example.com/@roger
Misskey: https://misskey.example.com/@roger
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex b/lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex index 70224561c..b9b175cc3 100644 --- a/lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex +++ b/lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/> +# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/> # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do @@ -98,8 +98,8 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do explicitly_mentioned_uris = extract_mention_uris_from_content(content) added_mentions = - Enum.reduce(mention_users, "", fn %User{ap_id: uri} = user, acc -> - unless uri in explicitly_mentioned_uris do + Enum.reduce(mention_users, "", fn %User{ap_id: api_id, uri: uri} = user, acc -> + unless Enum.any?([api_id, uri], fn u -> u in explicitly_mentioned_uris end) do acc <> Formatter.mention_from_user(user, %{mentions_format: :compact}) <> " " else acc |