summaryrefslogtreecommitdiff
path: root/test/web/activity_pub/object_validators/chat_validation_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-07-10 10:37:42 +0000
committerlain <lain@soykaf.club>2020-07-10 10:37:42 +0000
commitfba1ee7d7b04730c33cadb036f59e8d7c90a93b0 (patch)
tree32b20b5a0ec3f5c8d44f1157087868adfaa549b0 /test/web/activity_pub/object_validators/chat_validation_test.exs
parent8aa7143f464562ca2a0572087c526f26d1a3b7ef (diff)
parentb39eb6ecc573c310801fe49f35d92246ddcb6226 (diff)
downloadpleroma-fba1ee7d7b04730c33cadb036f59e8d7c90a93b0.tar.gz
pleroma-fba1ee7d7b04730c33cadb036f59e8d7c90a93b0.zip
Merge branch 'chat-federation-information' into 'develop'
Add an `accepts_chat_messages` to user, expose in api and federation See merge request pleroma/pleroma!2716
Diffstat (limited to 'test/web/activity_pub/object_validators/chat_validation_test.exs')
-rw-r--r--test/web/activity_pub/object_validators/chat_validation_test.exs11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/web/activity_pub/object_validators/chat_validation_test.exs b/test/web/activity_pub/object_validators/chat_validation_test.exs
index ec1e497fa..50bf03515 100644
--- a/test/web/activity_pub/object_validators/chat_validation_test.exs
+++ b/test/web/activity_pub/object_validators/chat_validation_test.exs
@@ -161,6 +161,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do
refute match?({:ok, _object, _meta}, ObjectValidator.validate(valid_chat_message, []))
end
+ test "does not validate if the recipient is not accepting chat messages", %{
+ valid_chat_message: valid_chat_message,
+ recipient: recipient
+ } do
+ recipient
+ |> Ecto.Changeset.change(%{accepts_chat_messages: false})
+ |> Pleroma.Repo.update!()
+
+ refute match?({:ok, _object, _meta}, ObjectValidator.validate(valid_chat_message, []))
+ end
+
test "does not validate if the actor or the recipient is not in our system", %{
valid_chat_message: valid_chat_message
} do