diff options
author | William Pitcock <nenolod@dereferenced.org> | 2019-02-04 17:48:48 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2019-02-04 17:48:48 +0000 |
commit | 64a3993425a062842a6affc7a6faa81c194c5e2b (patch) | |
tree | e8d55b65fa7582464d4ba8fd2432f0bc8c489dd2 | |
parent | ff2c28fd6d58b0985e8d59dfbe4ee0d52544e8b3 (diff) | |
download | pleroma-64a3993425a062842a6affc7a6faa81c194c5e2b.tar.gz |
activitypub: mrf: tag policy: add support for subscription control
-rw-r--r-- | lib/pleroma/web/activity_pub/mrf/tag_policy.ex | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex index dd3129707..901a0f2b0 100644 --- a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex @@ -85,6 +85,21 @@ defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do end end + defp process_tag( + "mrf_tag:disable-remote-subscription", + %{"type" => "Follow", "actor" => actor} = message + ) do + user = User.get_cached_by_ap_id(actor) + + if user.local == true do + {:ok, message} + else + {:reject, nil} + end + end + + defp process_tag("mrf_tag:disable-any-subscription", %{"type" => "Follow"}), do: {:reject, nil} + defp process_tag(_, message), do: {:ok, message} def filter_message(actor, message) do |