aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-04-07 15:11:29 +0100
committerSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-04-07 15:11:29 +0100
commit76fdfd1c7f10332783ef167b7b996edd4813b1c3 (patch)
treef76274b7e2d23f65e314833b37e6c5a49644364a /lib
parente6778003abcccdf35fe098a571023ed5f5a20323 (diff)
downloadpleroma-76fdfd1c7f10332783ef167b7b996edd4813b1c3.tar.gz
Add check on activity visibility in sub notification
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/common_api/utils.ex4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 4e0a6b2d9..a450a70c3 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -12,6 +12,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
alias Pleroma.Repo
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Utils
+ alias Pleroma.Web.ActivityPub.Visibility
alias Pleroma.Web.Endpoint
alias Pleroma.Web.MediaProxy
@@ -337,13 +338,14 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def maybe_notify_subscribers(
recipients,
- %Activity{data: %{"actor" => actor, "type" => type}}
+ %Activity{data: %{"actor" => actor, "type" => type}} = activity
)
when type == "Create" do
with %User{} = user <- User.get_by_ap_id(actor) do
subscriber_ids =
user
|> User.subscribers()
+ |> Enum.filter(&Visibility.visible_for_user?(activity, &1))
|> Enum.map(& &1.ap_id)
recipients ++ subscriber_ids