Dismiss the follow request notification on rejection

This commit is contained in:
eugenijm 2020-04-30 15:02:35 +03:00
commit bef34568f0
3 changed files with 22 additions and 0 deletions

View file

@ -261,6 +261,16 @@ defmodule Pleroma.Notification do
|> Repo.delete_all()
end
def dismiss(%Pleroma.Activity{} = activity) do
Notification
|> where([n], n.activity_id == ^activity.id)
|> Repo.delete_all()
|> case do
{_, notifications} -> {:ok, notifications}
_ -> {:error, "Cannot dismiss notification"}
end
end
def dismiss(%{id: user_id} = _user, id) do
notification = Repo.get(Notification, id)