diff options
author | Sadposter <hannah+pleroma@coffee-and-dreams.uk> | 2019-04-07 15:11:29 +0100 |
---|---|---|
committer | Sadposter <hannah+pleroma@coffee-and-dreams.uk> | 2019-04-07 15:11:29 +0100 |
commit | 76fdfd1c7f10332783ef167b7b996edd4813b1c3 (patch) | |
tree | f76274b7e2d23f65e314833b37e6c5a49644364a /lib | |
parent | e6778003abcccdf35fe098a571023ed5f5a20323 (diff) | |
download | pleroma-76fdfd1c7f10332783ef167b7b996edd4813b1c3.tar.gz |
Add check on activity visibility in sub notification
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 4 |
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 |