notification: add fallback get_notified_from_activity()
This commit is contained in:
parent
b9871e7e5a
commit
b3c360ce2c
|
@ -114,9 +114,11 @@ def create_notification(%Activity{} = activity, %User{} = user) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_notified_from_activity(activity, local_only \\ true)
|
||||||
|
|
||||||
def get_notified_from_activity(
|
def get_notified_from_activity(
|
||||||
%Activity{data: %{"to" => _, "type" => type} = data} = activity,
|
%Activity{data: %{"to" => _, "type" => type} = data} = activity,
|
||||||
local_only \\ true
|
local_only
|
||||||
)
|
)
|
||||||
when type in ["Create", "Like", "Announce", "Follow"] do
|
when type in ["Create", "Like", "Announce", "Follow"] do
|
||||||
recipients =
|
recipients =
|
||||||
|
@ -128,6 +130,8 @@ def get_notified_from_activity(
|
||||||
User.get_users_from_set(recipients, local_only)
|
User.get_users_from_set(recipients, local_only)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_notified_from_activity(_, local_only), do: []
|
||||||
|
|
||||||
defp maybe_notify_to_recipients(
|
defp maybe_notify_to_recipients(
|
||||||
recipients,
|
recipients,
|
||||||
%Activity{data: %{"to" => to, "type" => type}} = activity
|
%Activity{data: %{"to" => to, "type" => type}} = activity
|
||||||
|
|
Loading…
Reference in New Issue