diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-04 09:34:44 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-04 09:34:44 +0300 |
commit | 29a98b86b7056540ed4102a83dfe6a7e809c2519 (patch) | |
tree | 559c763669b1f647f96ff9fa67e36343da87565f /lib/pleroma/web/common_api/utils.ex | |
parent | 652cc6ba4b7a0494cc96ef4a9bfcaa3b5e5be60e (diff) | |
parent | 7722e5a67a46304f3ae0e37f674a44ca9268be5e (diff) | |
download | pleroma-29a98b86b7056540ed4102a83dfe6a7e809c2519.tar.gz |
Merge branch 'develop' into issue/1383
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r-- | lib/pleroma/web/common_api/utils.ex | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 88a5f434a..cbb64f8d2 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 @@ -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) |