diff options
author | Andrew Godwin | 2022-11-16 22:23:32 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-16 22:23:32 -0700 |
commit | b13c239213147b7acae4060aff35640d625b5169 (patch) | |
tree | 16c76dc20b3cc28403371c4b7817f636e22b13c1 /users/models/inbox_message.py | |
parent | 5b34ea46c3f458a174c5443714ade43c21defdac (diff) | |
download | takahe-b13c239213147b7acae4060aff35640d625b5169.tar.gz takahe-b13c239213147b7acae4060aff35640d625b5169.tar.bz2 takahe-b13c239213147b7acae4060aff35640d625b5169.zip |
Handle post edits, follow undos
Diffstat (limited to 'users/models/inbox_message.py')
-rw-r--r-- | users/models/inbox_message.py | 12 |
1 files changed, 11 insertions, 1 deletions
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": |