Merge branch 'dismiss-notification-on-follow-request-rejection' into 'develop'
[akkoma] / lib / pleroma / notification.ex
index aaa67525366c0aca362970525eb366e2403ba696..9a109dfabf66f6ebe55d56e6cb7731aa37daff70 100644 (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)