From: lain Date: Sat, 6 Jun 2020 14:59:08 +0000 (+0200) Subject: Notfication: Add validation of notification types X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=40fc4e974e5f60c3d61702b17029566774898e84;p=akkoma Notfication: Add validation of notification types --- diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 682a26912..3ac8737e2 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -61,9 +61,21 @@ defmodule Pleroma.Notification do |> Repo.aggregate(:count, :id) end + @notification_types ~w{ + favourite + follow + follow_request + mention + move + pleroma:chat_mention + pleroma:emoji_reaction + reblog + } + def changeset(%Notification{} = notification, attrs) do notification |> cast(attrs, [:seen, :type]) + |> validate_inclusion(:type, @notification_types) end @spec last_read_query(User.t()) :: Ecto.Queryable.t()