X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fnotification.ex;h=32f13df69c31a6400d77156b6fdfcaba36e0289d;hb=33f063204edb63344628bdfa72ff11f81ded62a9;hp=43a0e8f49aaac708e64d102e495cc6225bbac0e1;hpb=0114754db2d9dde25b31729644f898f20121de27;p=akkoma diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 43a0e8f49..32f13df69 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -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) @@ -631,11 +633,17 @@ defmodule Pleroma.Notification do :block_from_strangers, %Activity{} = activity, %User{notification_settings: %{block_from_strangers: true}} = user, - _opts + opts ) do actor = activity.data["actor"] follower = User.get_cached_by_ap_id(actor) - !User.following?(follower, user) + + cond do + opts[:type] == "poll" -> false + user.ap_id == actor -> false + !User.following?(follower, user) -> true + true -> false + end end # To do: consider defining recency in hours and checking FollowingRelationship with a single SQL