diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-04 18:56:31 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-12-04 18:56:31 +0300 |
commit | 30caf3e51e32830153e693727b3765e8817171a3 (patch) | |
tree | b752dd12604afa8be2bc7c753a64a5725bc2ebbc /lib/pleroma/notification.ex | |
parent | 52cc7de82cf3aa637d599edc357909be8c9366eb (diff) | |
parent | 228bf4d214abe3bb62c52128d3bc145e396b174d (diff) | |
download | pleroma-30caf3e51e32830153e693727b3765e8817171a3.tar.gz |
Merge remote-tracking branch 'remotes/upstream/develop' into 1335-user-api-id-fields-relations
# Conflicts:
# lib/pleroma/user.ex
Diffstat (limited to 'lib/pleroma/notification.ex')
-rw-r--r-- | lib/pleroma/notification.ex | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index d4b6eb3b8..43719b962 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -276,10 +276,13 @@ defmodule Pleroma.Notification do end end - def create_notifications(%Activity{data: %{"to" => _, "type" => type}} = activity) - when type in ["Like", "Announce", "Follow"] do - users = get_notified_from_activity(activity) - notifications = Enum.map(users, fn user -> create_notification(activity, user) end) + def create_notifications(%Activity{data: %{"type" => type}} = activity) + when type in ["Like", "Announce", "Follow", "Move"] do + notifications = + activity + |> get_notified_from_activity() + |> Enum.map(&create_notification(activity, &1)) + {:ok, notifications} end @@ -301,19 +304,15 @@ defmodule Pleroma.Notification do def get_notified_from_activity(activity, local_only \\ true) - def get_notified_from_activity( - %Activity{data: %{"to" => _, "type" => type} = _data} = activity, - local_only - ) - when type in ["Create", "Like", "Announce", "Follow"] do - recipients = - [] - |> Utils.maybe_notify_to_recipients(activity) - |> Utils.maybe_notify_mentioned_recipients(activity) - |> Utils.maybe_notify_subscribers(activity) - |> Enum.uniq() - - User.get_users_from_set(recipients, local_only) + def get_notified_from_activity(%Activity{data: %{"type" => type}} = activity, local_only) + when type in ["Create", "Like", "Announce", "Follow", "Move"] do + [] + |> Utils.maybe_notify_to_recipients(activity) + |> Utils.maybe_notify_mentioned_recipients(activity) + |> Utils.maybe_notify_subscribers(activity) + |> Utils.maybe_notify_followers(activity) + |> Enum.uniq() + |> User.get_users_from_set(local_only) end def get_notified_from_activity(_, _local_only), do: [] |