Runtime config: MRF changes

This commit is contained in:
href 2018-11-07 10:40:24 +01:00
parent 5bb88fd174
commit 9070588493
No known key found for this signature in database
GPG Key ID: EE8296C1A152C325
1 changed files with 4 additions and 3 deletions

View File

@ -7,6 +7,7 @@ defp check_accept(%{host: actor_host} = _actor_info, object) do
cond do cond do
accepts == [] -> {:ok, object} accepts == [] -> {:ok, object}
actor_host == Pleroma.Config.get([Pleroma.Web.Endpoint, :url, :host]) -> {:ok, object}
Enum.member?(accepts, actor_host) -> {:ok, object} Enum.member?(accepts, actor_host) -> {:ok, object}
true -> {:reject, nil} true -> {:reject, nil}
end end
@ -22,9 +23,9 @@ defp check_reject(%{host: actor_host} = _actor_info, object) do
defp check_media_removal( defp check_media_removal(
%{host: actor_host} = _actor_info, %{host: actor_host} = _actor_info,
%{"type" => "Create", "object" => %{"attachement" => child_attachement}} = object %{"type" => "Create", "object" => %{"attachement" => child_attachment}} = object
) )
when length(child_attachement) > 0 do when length(child_attachment) > 0 do
object = object =
if Enum.member?(Pleroma.Config.get([:mrf_simple, :media_removal]), actor_host) do if Enum.member?(Pleroma.Config.get([:mrf_simple, :media_removal]), actor_host) do
child_object = Map.delete(object["object"], "attachment") child_object = Map.delete(object["object"], "attachment")
@ -68,7 +69,7 @@ defp check_ftl_removal(%{host: actor_host} = _actor_info, object) do
Pleroma.Config.get([:mrf_simple, :federated_timeline_removal]), Pleroma.Config.get([:mrf_simple, :federated_timeline_removal]),
actor_host actor_host
), ),
user <- User.get_by_ap_id(object["actor"]), user <- User.get_cached_by_ap_id(object["actor"]),
true <- "https://www.w3.org/ns/activitystreams#Public" in object["to"], true <- "https://www.w3.org/ns/activitystreams#Public" in object["to"],
true <- user.follower_address in object["cc"] do true <- user.follower_address in object["cc"] do
to = to =