diff options
author | lain <lain@soykaf.club> | 2019-12-04 16:35:59 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-12-04 16:35:59 +0100 |
commit | e9993acdbbd1649bbcbf3fb36581b91145fe6055 (patch) | |
tree | b78d91c904e307a504ed91a06ab718d8c694ca5c /lib/pleroma/web/common_api/utils.ex | |
parent | 1bd1f62af55e01613e6362661b36a19091c87424 (diff) | |
parent | 228bf4d214abe3bb62c52128d3bc145e396b174d (diff) | |
download | pleroma-e9993acdbbd1649bbcbf3fb36581b91145fe6055.tar.gz |
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into remake-remodel
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) |