Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into chat-federation...
[akkoma] / test / web / activity_pub / object_validators / chat_validation_test.exs
index ec1e497fa32e59547d67d41217ce88776a5aba85..50bf03515dff31ab30905a920d1bc606e1b655c3 100644 (file)
@@ -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