From b4e5bda62e283fe61abe29328c5eafb732f1bb7a Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Mon, 23 Jul 2018 08:30:51 +0200 Subject: [PATCH] Tweak/debug --- activitypub.py | 13 ++----------- app.py | 5 ++++- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/activitypub.py b/activitypub.py index ec621e9..43d0576 100644 --- a/activitypub.py +++ b/activitypub.py @@ -384,26 +384,17 @@ class MicroblogPubBackend(Backend): @ensure_it_is_me def inbox_delete(self, as_actor: ap.Person, delete: ap.Delete) -> None: obj = delete.get_object() + logger.debug("delete object={obj!r}") DB.activities.update_one( {"activity.object.id": obj.id}, {"$set": {"meta.deleted": True}} ) - if obj.ACTIVITY_TYPE != ap.ActivityType.NOTE: - obj = ap.parse_activity( - DB.activities.find_one( - { - "activity.object.id": delete.get_object().id, - "type": ap.ActivityType.CREATE.value, - } - )["activity"] - ).get_object() - logger.info(f"inbox_delete handle_replies obj={obj!r}") # Fake a Undo so any related Like/Announce doesn't appear on the web UI DB.activities.update( {"meta.object.id": obj.id}, - {"$set": {"meta.undo": True, "meta.exta": "object deleted"}}, + {"$set": {"meta.undo": True, "meta.extra": "object deleted"}}, ) if obj: self._handle_replies_delete(as_actor, obj) diff --git a/app.py b/app.py index 9d6d127..a850d7f 100644 --- a/app.py +++ b/app.py @@ -241,7 +241,10 @@ def get_attachment_url(url, size): @app.template_filter() def get_og_image_url(url, size=100): - return _get_file_url(url, size, Kind.OG_IMAGE) + try: + return _get_file_url(url, size, Kind.OG_IMAGE) + except Exception: + return '' @app.template_filter()