Merge branch 'bugfix/chat-attachment-empty-array' into 'develop'
ChatMessage: Tolerate attachment field set to an empty array Closes #3224 See merge request pleroma/pleroma!4020
This commit is contained in:
commit
a6fc97ffec
3 changed files with 21 additions and 0 deletions
|
|
@ -147,6 +147,21 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
|
|||
assert object["attachment"]
|
||||
end
|
||||
|
||||
test "validates for a basic object with content but attachment set to empty array", %{
|
||||
user: user,
|
||||
recipient: recipient
|
||||
} do
|
||||
{:ok, valid_chat_message, _} = Builder.chat_message(user, recipient.ap_id, "Hello!")
|
||||
|
||||
valid_chat_message =
|
||||
valid_chat_message
|
||||
|> Map.put("attachment", [])
|
||||
|
||||
assert {:ok, object, _meta} = ObjectValidator.validate(valid_chat_message, [])
|
||||
|
||||
assert object == Map.drop(valid_chat_message, ["attachment"])
|
||||
end
|
||||
|
||||
test "does not validate if the message has no content", %{
|
||||
valid_chat_message: valid_chat_message
|
||||
} do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue