X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fnotification.ex;h=d8878338ee5859b90f9a1ca843a4afc4871e4d69;hb=0f132b802dde7f217ecb07767e0d34e3edb517b7;hp=9e0ce0329e2638652eded2a150d4fc1087c9d013;hpb=e1b89fe3aa2c03576a6f2418c1e83c0ed64707a3;p=akkoma diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 9e0ce0329..d8878338e 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -68,7 +68,6 @@ defmodule Pleroma.Notification do follow_request mention move - pleroma:chat_mention pleroma:emoji_reaction pleroma:report reblog @@ -341,6 +340,14 @@ defmodule Pleroma.Notification do |> Repo.delete_all() end + def destroy_multiple_from_types(%{id: user_id}, types) do + from(n in Notification, + where: n.user_id == ^user_id, + where: n.type in ^types + ) + |> Repo.delete_all() + end + def dismiss(%Pleroma.Activity{} = activity) do Notification |> where([n], n.activity_id == ^activity.id) @@ -436,16 +443,7 @@ defmodule Pleroma.Notification do end end - defp type_from_activity_object(%{data: %{"type" => "Create", "object" => %{}}}), do: "mention" - - defp type_from_activity_object(%{data: %{"type" => "Create"}} = activity) do - object = Object.get_by_ap_id(activity.data["object"]) - - case object && object.data["type"] do - "ChatMessage" -> "pleroma:chat_mention" - _ -> "mention" - end - end + defp type_from_activity_object(%{data: %{"type" => "Create"}}), do: "mention" # TODO move to sql, too. def create_notification(%Activity{} = activity, %User{} = user, opts \\ []) do