mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-03-30 07:15:28 +00:00
QuestionValidator: Drop likes if it is not a list
This appears to be an issue exclusive to refetching the object when refreshing a poll
This commit is contained in:
parent
3f3f8bc57a
commit
3ef40ecc06
2 changed files with 9 additions and 0 deletions
1
changelog.d/question-validator.fix
Normal file
1
changelog.d/question-validator.fix
Normal file
|
@ -0,0 +1 @@
|
|||
Polls could fail to refresh due to an incorrect data validation constraint.
|
|
@ -59,6 +59,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
|
|||
end
|
||||
end
|
||||
|
||||
defp fix_likes(data) do
|
||||
cond do
|
||||
is_list(data["likes"]) -> data
|
||||
true -> Map.drop(data, ["likes"])
|
||||
end
|
||||
end
|
||||
|
||||
defp fix(data) do
|
||||
data
|
||||
|> CommonFixes.fix_actor()
|
||||
|
@ -66,6 +73,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do
|
|||
|> CommonFixes.fix_quote_url()
|
||||
|> Transmogrifier.fix_emoji()
|
||||
|> fix_closed()
|
||||
|> fix_likes()
|
||||
end
|
||||
|
||||
def changeset(struct, data) do
|
||||
|
|
Loading…
Reference in a new issue