mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Tweak the tombstone support
This commit is contained in:
parent
7b6982c959
commit
8ae3f1e3a3
1 changed files with 5 additions and 0 deletions
|
@ -25,6 +25,7 @@ from little_boxes import strtobool
|
||||||
from little_boxes.activitypub import _to_list
|
from little_boxes.activitypub import _to_list
|
||||||
from little_boxes.backend import Backend
|
from little_boxes.backend import Backend
|
||||||
from little_boxes.errors import Error
|
from little_boxes.errors import Error
|
||||||
|
from little_boxes.errors import ActivityGoneError
|
||||||
from utils.media import Kind
|
from utils.media import Kind
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -150,6 +151,8 @@ class MicroblogPubBackend(Backend):
|
||||||
iri = iri.replace("/activity", "")
|
iri = iri.replace("/activity", "")
|
||||||
is_a_note = True
|
is_a_note = True
|
||||||
data = DB.activities.find_one({"box": Box.OUTBOX.value, "remote_id": iri})
|
data = DB.activities.find_one({"box": Box.OUTBOX.value, "remote_id": iri})
|
||||||
|
if data and data["meta"]["deleted"]:
|
||||||
|
raise ActivityGoneError(f"{iri} is gone")
|
||||||
if data and is_a_note:
|
if data and is_a_note:
|
||||||
return data["activity"]["object"]
|
return data["activity"]["object"]
|
||||||
elif data:
|
elif data:
|
||||||
|
@ -158,6 +161,8 @@ class MicroblogPubBackend(Backend):
|
||||||
# Check if the activity is stored in the inbox
|
# Check if the activity is stored in the inbox
|
||||||
data = DB.activities.find_one({"remote_id": iri})
|
data = DB.activities.find_one({"remote_id": iri})
|
||||||
if data:
|
if data:
|
||||||
|
if data["meta"]["deleted"]:
|
||||||
|
raise ActivityGoneError(f"{iri} is gone")
|
||||||
return data["activity"]
|
return data["activity"]
|
||||||
|
|
||||||
# Fetch the URL via HTTP
|
# Fetch the URL via HTTP
|
||||||
|
|
Loading…
Reference in a new issue