diff --git a/protocol.py b/protocol.py index 3d4ba1c5..76ddd4b2 100644 --- a/protocol.py +++ b/protocol.py @@ -1576,12 +1576,15 @@ class Protocol: return inner_type = as1.object_type(as1.get_object(obj.as1)) or '' - if (obj.type not in cls.SUPPORTED_AS1_TYPES or - (obj.type in as1.CRUD_VERBS - and inner_type - and inner_type not in cls.SUPPORTED_AS1_TYPES)): + if (obj.type not in cls.SUPPORTED_AS1_TYPES + or (obj.type in as1.CRUD_VERBS + and inner_type + and inner_type not in cls.SUPPORTED_AS1_TYPES)): error(f"Bridgy Fed for {cls.LABEL} doesn't support {obj.type} {inner_type} yet", status=204) + if as1.is_dm(obj.as1): + error(f"Bridgy Fed doesn't support DMs", status=204) + @cloud_tasks_only def receive_task(): diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 4c7ecd3e..509265d7 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -720,6 +720,14 @@ class ProtocolTest(TestCase): with self.assertRaises(NoContent): Fake.check_supported(Object(our_as1=obj)) + # DM + with self.assertRaises(NoContent): + Fake.check_supported(Object(our_as1={ + 'objectType': 'note', + 'actor': 'did:alice', + 'to': ['did:bob'], + 'content': 'hello world', + })) class ProtocolReceiveTest(TestCase):