Poll notification: only notify local users

This commit is contained in:
Alex Gleason 2021-07-18 11:03:56 -05:00
commit 70f1496eb8
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 6 additions and 4 deletions

View file

@ -471,9 +471,11 @@ defmodule Pleroma.Notification do
end
notifications =
Enum.map([actor | voters], fn ap_id ->
with %User{} = user <- User.get_by_ap_id(ap_id) do
create_notification(activity, user, type: "poll")
Enum.reduce([actor | voters], [], fn ap_id, acc ->
with %User{local: true} = user <- User.get_by_ap_id(ap_id) do
[create_notification(activity, user, type: "poll") | acc]
else
_ -> acc
end
end)