diff options
| author | lain <lain@soykaf.club> | 2020-06-06 16:59:08 +0200 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-06-06 16:59:08 +0200 | 
| commit | 40fc4e974e5f60c3d61702b17029566774898e84 (patch) | |
| tree | d2800ac475f1f75696ba65fe1cf056b256c104ab /lib | |
| parent | f4cf4ae16ee84655bf6630cf7e98e9eef2f410cc (diff) | |
| download | pleroma-40fc4e974e5f60c3d61702b17029566774898e84.tar.gz pleroma-40fc4e974e5f60c3d61702b17029566774898e84.zip | |
Notfication: Add validation of notification types
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pleroma/notification.ex | 12 | 
1 files changed, 12 insertions, 0 deletions
| 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() | 
