From b13c239213147b7acae4060aff35640d625b5169 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Wed, 16 Nov 2022 22:23:32 -0700 Subject: Handle post edits, follow undos --- users/models/inbox_message.py | 12 +++++++++++- 1 file changed, 11 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 55eb3cb..ee23ae6 100644 --- a/users/models/inbox_message.py +++ b/users/models/inbox_message.py @@ -13,7 +13,7 @@ class InboxMessageStates(StateGraph): @classmethod async def handle_received(cls, instance: "InboxMessage"): from activities.models import Post, PostInteraction - from users.models import Follow + from users.models import Follow, Identity match instance.message_type: case "follow": @@ -30,6 +30,16 @@ class InboxMessageStates(StateGraph): raise ValueError( f"Cannot handle activity of type create.{unknown}" ) + case "update": + match instance.message_object_type: + case "note": + await sync_to_async(Post.handle_update_ap)(instance.message) + case "person": + await sync_to_async(Identity.handle_update_ap)(instance.message) + case unknown: + raise ValueError( + f"Cannot handle activity of type update.{unknown}" + ) case "accept": match instance.message_object_type: case "follow": -- cgit v1.2.3