aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/notification.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-03-04 19:55:11 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-03-04 19:55:11 +0700
commiteb84de01439c4ee25f59390e5be4ffa7f36e01b8 (patch)
tree63c935841bf4063278baff298e00724a2db46794 /lib/pleroma/notification.ex
parentdd5865535eb16f535ff996eb3dec5e947a905268 (diff)
downloadpleroma-eb84de01439c4ee25f59390e5be4ffa7f36e01b8.tar.gz
allow users to disable their own account
Diffstat (limited to 'lib/pleroma/notification.ex')
-rw-r--r--lib/pleroma/notification.ex32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex
index c88512567..0f9f74b1e 100644
--- a/lib/pleroma/notification.ex
+++ b/lib/pleroma/notification.ex
@@ -36,22 +36,22 @@ defmodule Pleroma.Notification do
defp restrict_since(query, _), do: query
def for_user(user, opts \\ %{}) do
- query =
- from(
- n in Notification,
- where: n.user_id == ^user.id,
- order_by: [desc: n.id],
- join: activity in assoc(n, :activity),
- preload: [activity: activity],
- limit: 20
- )
-
- query =
- query
- |> restrict_since(opts)
- |> restrict_max(opts)
-
- Repo.all(query)
+ from(
+ n in Notification,
+ where: n.user_id == ^user.id,
+ order_by: [desc: n.id],
+ join: activity in assoc(n, :activity),
+ preload: [activity: activity],
+ limit: 20,
+ where:
+ fragment(
+ "? not in (SELECT ap_id FROM users WHERE info->'disabled' @> 'true')",
+ activity.actor
+ )
+ )
+ |> restrict_since(opts)
+ |> restrict_max(opts)
+ |> Repo.all()
end
def set_read_up_to(%{id: user_id} = _user, id) do