Skip to content
Snippets Groups Projects
Commit f16c2e0b authored by kaniini's avatar kaniini
Browse files

notification: add Notification.set_read_up_to()

parent e1c40b8c
Branches
No related tags found
No related merge requests found
......@@ -42,6 +42,20 @@ defmodule Pleroma.Notification do
Repo.all(query)
end
def set_read_up_to(%{id: user_id} = _user, id) do
query =
from(
n in Notification,
where: n.user_id == ^user_id,
where: n.id <= ^id,
update: [
set: [seen: true]
]
)
Repo.update_all(query, [])
end
def get(%{id: user_id} = _user, id) do
query =
from(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment