1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublic do
7 @behaviour Pleroma.Web.ActivityPub.MRF
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"
23 policy = Pleroma.Config.get(:mrf_rejectnonpublic)
33 with true <- Keyword.get(policy, :allow_followersonly) do
40 with true <- Keyword.get(policy, :allow_direct) do
49 def filter(object), do: {:ok, object}