diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-05 12:18:59 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-12-05 12:18:59 +0300 |
commit | e21afdb7c76c9773aeb51e37ff3bc2874e7a74f7 (patch) | |
tree | fd8ca0c111cff6ef663b4272d64d64333a451032 /lib/pleroma/web/common_api/utils.ex | |
parent | 88f7cf51d43181b27db5ff1807d3e706fa336bac (diff) | |
parent | 228bf4d214abe3bb62c52128d3bc145e396b174d (diff) | |
download | pleroma-e21afdb7c76c9773aeb51e37ff3bc2874e7a74f7.tar.gz |
Merge branch 'develop' into issue/1411
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) |