mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-29 02:31:00 +00:00
Handle undos of missing posts
This commit is contained in:
parent
f262f582cb
commit
a7d389020a
1 changed files with 6 additions and 2 deletions
|
@ -271,7 +271,7 @@ class PostInteraction(StatorModel):
|
||||||
type=type,
|
type=type,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise KeyError(f"No post with ID {data['id']}", data)
|
raise cls.DoesNotExist(f"No interaction with ID {data['id']}", data)
|
||||||
return boost
|
return boost
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -301,7 +301,11 @@ class PostInteraction(StatorModel):
|
||||||
"""
|
"""
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
# Find it
|
# 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
|
# Verify the actor matches
|
||||||
if data["actor"] != interaction.identity.actor_uri:
|
if data["actor"] != interaction.identity.actor_uri:
|
||||||
raise ValueError("Actor mismatch on interaction undo")
|
raise ValueError("Actor mismatch on interaction undo")
|
||||||
|
|
Loading…
Reference in a new issue