logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 1bbc701a3ababc4c6e856ad24f8826da0a0ba1a3
parent 19d557c870c3ec43dd3b0ee7ea85259a89bd9a80
Author: Alex Gleason <alex@alexgleason.me>
Date:   Mon, 24 Jan 2022 19:11:14 -0600

ForceMentionsInContent: use `to` instead of `tag`

Diffstat:

Mlib/pleroma/web/activity_pub/mrf/force_mentions_in_content.ex7++-----
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 @@ -35,15 +35,12 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent 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}