X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fnotification.ex;h=82faef85e3e28bd3053cb8fe72fea66c40b99060;hb=c31ddce51ea18f052c1c3ad30a221b77c7a94e71;hp=21b26a53d7b894369a446ebc1d0ee31a2a49d111;hpb=c6fdfbc4f14b855d9cdf2d757ff2c43282aabe90;p=akkoma diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 21b26a53d..82faef85e 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -55,9 +55,21 @@ defmodule Pleroma.Notification do ) |> preload([n, a, o], activity: {a, object: o}) |> exclude_muted(user, opts) + |> exclude_blocked(user) |> exclude_visibility(opts) end + defp exclude_blocked(query, user) do + blocked_ap_ids = User.blocked_ap_ids(user) + + query + |> where([n, a], a.actor not in ^blocked_ap_ids) + |> where( + [n, a], + fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.domain_blocks + ) + end + defp exclude_muted(query, _, %{with_muted: true}) do query end @@ -65,11 +77,6 @@ defmodule Pleroma.Notification do defp exclude_muted(query, user, _opts) do query |> where([n, a], a.actor not in ^user.muted_notifications) - |> where([n, a], a.actor not in ^user.blocks) - |> where( - [n, a], - fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.domain_blocks - ) |> join(:left, [n, a], tm in Pleroma.ThreadMute, on: tm.user_id == ^user.id and tm.context == fragment("?->>'context'", a.data) )