diff options
author | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-23 17:22:42 +0300 |
---|---|---|
committer | Ivan Tashkinov <ivantashkinov@gmail.com> | 2019-10-23 17:22:42 +0300 |
commit | 8cc809e44e3a899f93061c4c5f68d9736d79d79e (patch) | |
tree | 8193991e2a2b705a60d847a626d22abaf756d7f1 /lib/pleroma/notification.ex | |
parent | 11cd9944258bfc2123b821b21321e12097d0f19b (diff) | |
parent | 54077677eaad44ea355c7f0db7ea5e94183d5a30 (diff) | |
download | pleroma-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.ex | 15 |
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) ) |