add tests
This commit is contained in:
parent
aa64b3108b
commit
d3fb9e02cc
4 changed files with 23 additions and 7 deletions
|
|
@ -58,7 +58,8 @@ defmodule Pleroma.Marker do
|
|||
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)
|
||||
last_read_id:
|
||||
type(fragment("MAX( CASE WHEN seen = true THEN id ELSE null END )"), :string)
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -77,11 +78,7 @@ defmodule Pleroma.Marker do
|
|||
)
|
||||
end
|
||||
|
||||
def set_unread_count(%User{} = user, timeline) do
|
||||
Multi.new()
|
||||
|> multi_set_unread_count(user, timeline)
|
||||
|> Repo.transaction()
|
||||
end
|
||||
def multi_set_unread_count(multi, _, _), do: multi
|
||||
|
||||
defp get_marker(user, timeline) do
|
||||
case Repo.find_resource(get_query(user, timeline)) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue