Handle updates for already deleted posts
This commit is contained in:
parent
c5f52581c9
commit
13fd3785f2
|
@ -643,7 +643,7 @@ class Post(StatorModel):
|
||||||
)
|
)
|
||||||
created = True
|
created = True
|
||||||
else:
|
else:
|
||||||
raise KeyError(f"No post with ID {data['id']}", data)
|
raise cls.DoesNotExist(f"No post with ID {data['id']}", data)
|
||||||
if update or created:
|
if update or created:
|
||||||
post.content = data["content"]
|
post.content = data["content"]
|
||||||
post.summary = data.get("summary")
|
post.summary = data.get("summary")
|
||||||
|
@ -755,7 +755,11 @@ class Post(StatorModel):
|
||||||
if data["actor"] != data["object"]["attributedTo"]:
|
if data["actor"] != data["object"]["attributedTo"]:
|
||||||
raise ValueError("Create actor does not match its Post object", data)
|
raise ValueError("Create actor does not match its Post object", data)
|
||||||
# Find it and update it
|
# Find it and update it
|
||||||
cls.by_ap(data["object"], create=False, update=True)
|
try:
|
||||||
|
cls.by_ap(data["object"], create=False, update=True)
|
||||||
|
except cls.DoesNotExist:
|
||||||
|
# We don't have a copy - assume we got a delete first and ignore.
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def handle_delete_ap(cls, data):
|
def handle_delete_ap(cls, data):
|
||||||
|
|
Loading…
Reference in New Issue