Tweak/debug

This commit is contained in:
Thomas Sileo 2018-07-23 08:30:51 +02:00
parent 7cf6027bf9
commit b4e5bda62e
2 changed files with 6 additions and 12 deletions

View file

@ -384,26 +384,17 @@ class MicroblogPubBackend(Backend):
@ensure_it_is_me @ensure_it_is_me
def inbox_delete(self, as_actor: ap.Person, delete: ap.Delete) -> None: def inbox_delete(self, as_actor: ap.Person, delete: ap.Delete) -> None:
obj = delete.get_object() obj = delete.get_object()
logger.debug("delete object={obj!r}")
DB.activities.update_one( DB.activities.update_one(
{"activity.object.id": obj.id}, {"$set": {"meta.deleted": True}} {"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}") 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 # Fake a Undo so any related Like/Announce doesn't appear on the web UI
DB.activities.update( DB.activities.update(
{"meta.object.id": obj.id}, {"meta.object.id": obj.id},
{"$set": {"meta.undo": True, "meta.exta": "object deleted"}}, {"$set": {"meta.undo": True, "meta.extra": "object deleted"}},
) )
if obj: if obj:
self._handle_replies_delete(as_actor, obj) self._handle_replies_delete(as_actor, obj)

3
app.py
View file

@ -241,7 +241,10 @@ def get_attachment_url(url, size):
@app.template_filter() @app.template_filter()
def get_og_image_url(url, size=100): def get_og_image_url(url, size=100):
try:
return _get_file_url(url, size, Kind.OG_IMAGE) return _get_file_url(url, size, Kind.OG_IMAGE)
except Exception:
return ''
@app.template_filter() @app.template_filter()