From 64a3993425a062842a6affc7a6faa81c194c5e2b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 4 Feb 2019 17:48:48 +0000 Subject: [PATCH] activitypub: mrf: tag policy: add support for subscription control --- lib/pleroma/web/activity_pub/mrf/tag_policy.ex | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- 2.45.2