aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/utils.ex
diff options
context:
space:
mode:
authorMaxim Filippov <colixer@gmail.com>2019-12-12 02:16:23 +0300
committerMaxim Filippov <colixer@gmail.com>2019-12-12 02:16:23 +0300
commit3ecf131511afc1fc366be6402ca94cf0e6c30e11 (patch)
tree0e8a59c43ccc344bb7d57c32826675aa706b7e8e /lib/pleroma/web/common_api/utils.ex
parentcc36a8ea906bd22884101632c6d62c9572e846e1 (diff)
parentfd697cf2090b61db60a02694c3227850df176e2d (diff)
downloadpleroma-3ecf131511afc1fc366be6402ca94cf0e6c30e11.tar.gz
Merge branch 'develop' into feature/report-notes
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r--lib/pleroma/web/common_api/utils.ex15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 88a5f434a..a9b164d9a 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -451,6 +451,8 @@ defmodule Pleroma.Web.CommonAPI.Utils do
recipients ++ to
end
+ def maybe_notify_to_recipients(recipients, _), do: recipients
+
def maybe_notify_mentioned_recipients(
recipients,
%Activity{data: %{"to" => _to, "type" => type} = data} = activity
@@ -492,7 +494,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
with %User{} = user <- User.get_cached_by_ap_id(actor) do
subscriber_ids =
user
- |> User.subscribers()
+ |> User.subscriber_users()
|> Enum.filter(&Visibility.visible_for_user?(activity, &1))
|> Enum.map(& &1.ap_id)
@@ -502,6 +504,17 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def maybe_notify_subscribers(recipients, _), do: recipients
+ def maybe_notify_followers(recipients, %Activity{data: %{"type" => "Move"}} = activity) do
+ with %User{} = user <- User.get_cached_by_ap_id(activity.actor) do
+ user
+ |> User.get_followers()
+ |> Enum.map(& &1.ap_id)
+ |> Enum.concat(recipients)
+ end
+ end
+
+ def maybe_notify_followers(recipients, _), do: recipients
+
def maybe_extract_mentions(%{"tag" => tag}) do
tag
|> Enum.filter(fn x -> is_map(x) && x["type"] == "Mention" end)