aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/notification.ex
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2019-10-23 17:22:42 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2019-10-23 17:22:42 +0300
commit8cc809e44e3a899f93061c4c5f68d9736d79d79e (patch)
tree8193991e2a2b705a60d847a626d22abaf756d7f1 /lib/pleroma/notification.ex
parent11cd9944258bfc2123b821b21321e12097d0f19b (diff)
parent54077677eaad44ea355c7f0db7ea5e94183d5a30 (diff)
downloadpleroma-8cc809e44e3a899f93061c4c5f68d9736d79d79e.tar.gz
Merge remote-tracking branch 'remotes/upstream/develop' into 1304-user-info-deprecation
# Conflicts: # lib/pleroma/notification.ex
Diffstat (limited to 'lib/pleroma/notification.ex')
-rw-r--r--lib/pleroma/notification.ex15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index 21b26a53d..83844d3be 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -55,9 +55,19 @@ 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
+ query
+ |> where([n, a], a.actor not in ^user.info.blocks)
+ |> where(
+ [n, a],
+ fragment("substring(? from '.*://([^/]*)')", a.actor) not in ^user.info.domain_blocks
+ )
+ end
+
defp exclude_muted(query, _, %{with_muted: true}) do
query
end
@@ -65,11 +75,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)
)