projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f4cf4ae
)
Notfication: Add validation of notification types
author
lain
<lain@soykaf.club>
Sat, 6 Jun 2020 14:59:08 +0000
(16:59 +0200)
committer
lain
<lain@soykaf.club>
Sat, 6 Jun 2020 14:59:08 +0000
(16:59 +0200)
lib/pleroma/notification.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/notification.ex
b/lib/pleroma/notification.ex
index 682a26912a5a7fe04d5af08ee256de2ec089d0d4..3ac8737e20ab522d214264cb8f9d594ccf973c79 100644
(file)
--- 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()