From 8ae3f1e3a3e34fa1dd54c55a77350bfef4dc615e Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Tue, 10 Jul 2018 00:25:26 +0200 Subject: [PATCH] Tweak the tombstone support --- activitypub.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/activitypub.py b/activitypub.py index 37b7ef1..f591a5b 100644 --- a/activitypub.py +++ b/activitypub.py @@ -25,6 +25,7 @@ from little_boxes import strtobool from little_boxes.activitypub import _to_list from little_boxes.backend import Backend from little_boxes.errors import Error +from little_boxes.errors import ActivityGoneError from utils.media import Kind logger = logging.getLogger(__name__) @@ -150,6 +151,8 @@ class MicroblogPubBackend(Backend): iri = iri.replace("/activity", "") is_a_note = True 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: return data["activity"]["object"] elif data: @@ -158,6 +161,8 @@ class MicroblogPubBackend(Backend): # Check if the activity is stored in the inbox data = DB.activities.find_one({"remote_id": iri}) if data: + if data["meta"]["deleted"]: + raise ActivityGoneError(f"{iri} is gone") return data["activity"] # Fetch the URL via HTTP