diff options
author | Andrew Godwin | 2022-12-16 20:17:19 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-12-16 20:17:19 -0700 |
commit | a7d389020a00a9c75281d66cdaf6a5e12b3dc2ba (patch) | |
tree | 6f82b312a8a24dbce39c942a32d3329056c82e82 /activities/models | |
parent | f262f582cbe901ec45f39162af4aec5c54ff4e07 (diff) | |
download | takahe-a7d389020a00a9c75281d66cdaf6a5e12b3dc2ba.tar.gz takahe-a7d389020a00a9c75281d66cdaf6a5e12b3dc2ba.tar.bz2 takahe-a7d389020a00a9c75281d66cdaf6a5e12b3dc2ba.zip |
Handle undos of missing posts
Diffstat (limited to 'activities/models')
-rw-r--r-- | activities/models/post_interaction.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activities/models/post_interaction.py b/activities/models/post_interaction.py index 9630948..69918ab 100644 --- a/activities/models/post_interaction.py +++ b/activities/models/post_interaction.py @@ -271,7 +271,7 @@ class PostInteraction(StatorModel): type=type, ) else: - raise KeyError(f"No post with ID {data['id']}", data) + raise cls.DoesNotExist(f"No interaction with ID {data['id']}", data) return boost @classmethod @@ -301,7 +301,11 @@ class PostInteraction(StatorModel): """ with transaction.atomic(): # Find it - interaction = cls.by_ap(data["object"]) + try: + interaction = cls.by_ap(data["object"]) + except cls.DoesNotExist: + # Well I guess we don't need to undo it do we + return # Verify the actor matches if data["actor"] != interaction.identity.actor_uri: raise ValueError("Actor mismatch on interaction undo") |