From 1bbc701a3ababc4c6e856ad24f8826da0a0ba1a3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 24 Jan 2022 19:11:14 -0600 Subject: ForceMentionsInContent: use `to` instead of `tag` --- lib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex | 7 ++----- 1 file changed, 2 insertions(+), 5 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 522ae2f60..8d3885d7b 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 @@ -35,15 +35,12 @@ defp extract_mention_uris_from_content(content) do end @impl true - def filter(%{"type" => "Create", "object" => %{"type" => "Note", "tag" => tag}} = object) do + def filter(%{"type" => "Create", "object" => %{"type" => "Note", "to" => to}} = object) do # image-only posts from pleroma apparently reach this MRF without the content field content = object["object"]["content"] || "" mention_users = - tag - |> Enum.filter(fn tag -> tag["type"] == "Mention" end) - |> Enum.map(& &1["href"]) - |> Enum.reject(&is_nil/1) + to |> Enum.map(fn ap_id_or_uri -> case User.get_or_fetch_by_ap_id(ap_id_or_uri) do {:ok, user} -> {ap_id_or_uri, user} -- cgit v1.2.3