1 defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublic do
3 @behaviour Pleroma.Web.ActivityPub.MRF
5 @mrf_rejectnonpublic Application.get_env(:pleroma, :mrf_rejectnonpublic)
6 @allow_followersonly Keyword.get(@mrf_rejectnonpublic, :allow_followersonly)
7 @allow_direct Keyword.get(@mrf_rejectnonpublic, :allow_direct)
10 def filter(%{"type" => "Create"} = object) do
11 user = User.get_cached_by_ap_id(object["actor"])
12 public = "https://www.w3.org/ns/activitystreams#Public"
14 # Determine visibility
17 public in object["to"] -> "public"
18 public in object["cc"] -> "unlisted"
19 user.follower_address in object["to"] -> "followers"
31 with true <- @allow_followersonly do
38 with true <- @allow_direct do
47 def filter(object), do: {:ok, object}