ForceMentionsInContent: don't apply it to top-level posts

This commit is contained in:
Alex Gleason 2022-01-26 21:24:26 -06:00
commit 27cb3d6273
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 32 additions and 2 deletions

View file

@ -72,8 +72,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceMentionsInContent do
end
@impl true
def filter(%{"type" => "Create", "object" => %{"type" => "Note", "to" => to}} = object)
when is_list(to) do
def filter(
%{
"type" => "Create",
"object" => %{"type" => "Note", "to" => to, "inReplyTo" => in_reply_to}
} = object
)
when is_list(to) and is_binary(in_reply_to) do
# image-only posts from pleroma apparently reach this MRF without the content field
content = object["object"]["content"] || ""