Tweak the tombstone support

This commit is contained in:
Thomas Sileo 2018-07-10 00:25:26 +02:00
parent 7b6982c959
commit 8ae3f1e3a3

View file

@ -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