1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.MRF.LockSmasher do
9 @behaviour Pleroma.Web.ActivityPub.MRF.Policy
11 require Pleroma.Constants
23 actor_info = URI.parse(actor)
24 user = User.get_cached_by_ap_id(actor)
25 instance_domain = Config.get([Pleroma.Web.Endpoint, :url, :host])
27 # Determine visibility
30 Pleroma.Constants.as_public() in to -> "public"
31 Pleroma.Constants.as_public() in cc -> "unlisted"
32 user.follower_address in to -> "followers"
36 if visibility in ["unlisted", "followers"] and actor_info.host != instance_domain do
37 to = List.delete(to, user.follower_address) ++ [Pleroma.Constants.as_public()]
38 cc = List.delete(cc, Pleroma.Constants.as_public()) ++ [user.follower_address]
49 |> Map.put("object", object)
59 def filter(message), do: {:ok, message}
62 def describe, do: {:ok, %{}}