diff options
author | Maksim Pechnikov <parallel588@gmail.com> | 2019-10-24 09:50:41 +0300 |
---|---|---|
committer | Maksim Pechnikov <parallel588@gmail.com> | 2019-10-24 12:17:50 +0300 |
commit | 922e3d082c38ccd108710e21d4bda8e65b551f9c (patch) | |
tree | ec507af94b47050efb8f263dd74ede0f72bf9514 /lib/pleroma/marker.ex | |
parent | 99cf1ef9be93ebab04d088848804369e6295a76d (diff) | |
download | pleroma-922e3d082c38ccd108710e21d4bda8e65b551f9c.tar.gz |
add test
Diffstat (limited to 'lib/pleroma/marker.ex')
-rw-r--r-- | lib/pleroma/marker.ex | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/lib/pleroma/marker.ex b/lib/pleroma/marker.ex index 5f6a47f38..a7ea542dd 100644 --- a/lib/pleroma/marker.ex +++ b/lib/pleroma/marker.ex @@ -51,19 +51,7 @@ defmodule Pleroma.Marker do def multi_set_unread_count(multi, %User{} = user, "notifications") do multi |> Multi.run(:counters, fn _repo, _changes -> - query = - from(q in Pleroma.Notification, - where: q.user_id == ^user.id, - select: %{ - timeline: "notifications", - user_id: type(^user.id, :string), - unread_count: fragment("SUM( CASE WHEN seen = false THEN 1 ELSE 0 END )"), - last_read_id: - type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string) - } - ) - - {:ok, Repo.one(query)} + {:ok, Repo.one(Pleroma.Notification.notifications_info_query(user))} end) |> Multi.insert( :marker, |