1 defmodule Pleroma.Web.ActivityPub.MRF.EnsureRePrepended do
4 @behaviour Pleroma.Web.ActivityPub.MRF
7 %{"summary" => parent_summary} = parent,
8 %{"summary" => child_summary} = child
10 when not is_nil(child_summary) and child_summary == parent_summary and
11 byte_size(child_summary) > 1 do
12 if not String.starts_with?(child_summary, "re:") do
13 Map.put(child, "summary", "re: " <> child_summary)
19 def filter_by_summary(parent, child), do: child
21 def filter(%{"type" => activity_type} = object) when activity_type == "Create" do
22 child = object["object"]
23 in_reply_to = Activity.get_create_activity_by_object_ap_id(child["inReplyTo"])
27 do: filter_by_summary(in_reply_to.data["object"], child),
31 object = Map.put(object, "object", child)
36 def filter(object), do: {:ok, object}