From 64f113dd8d102282da8f013ab2acf6e1c24a5934 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 17 Dec 2022 14:58:04 -0700 Subject: Receive inbound reports --- users/models/inbox_message.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'users/models/inbox_message.py') diff --git a/users/models/inbox_message.py b/users/models/inbox_message.py index 6c36043..d6d4f43 100644 --- a/users/models/inbox_message.py +++ b/users/models/inbox_message.py @@ -16,7 +16,7 @@ class InboxMessageStates(StateGraph): @classmethod async def handle_received(cls, instance: "InboxMessage"): from activities.models import Post, PostInteraction - from users.models import Follow, Identity + from users.models import Follow, Identity, Report match instance.message_type: case "follow": @@ -29,6 +29,8 @@ class InboxMessageStates(StateGraph): match instance.message_object_type: case "note": await sync_to_async(Post.handle_create_ap)(instance.message) + case "question": + pass # Drop for now case unknown: raise ValueError( f"Cannot handle activity of type create.{unknown}" @@ -39,6 +41,8 @@ class InboxMessageStates(StateGraph): await sync_to_async(Post.handle_update_ap)(instance.message) case "person": await sync_to_async(Identity.handle_update_ap)(instance.message) + case "question": + pass # Drop for now case unknown: raise ValueError( f"Cannot handle activity of type update.{unknown}" @@ -87,6 +91,9 @@ class InboxMessageStates(StateGraph): case "remove": # We are ignoring these right now (probably pinned items) pass + case "flag": + # Received reports + await sync_to_async(Report.handle_ap)(instance.message) case unknown: raise ValueError(f"Cannot handle activity of type {unknown}") return cls.processed -- cgit v1.2.3