forked from forks/microblog.pub
Tweak/debug
This commit is contained in:
parent
7cf6027bf9
commit
b4e5bda62e
2 changed files with 6 additions and 12 deletions
|
@ -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)
|
||||||
|
|
5
app.py
5
app.py
|
@ -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):
|
||||||
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()
|
@app.template_filter()
|
||||||
|
|
Loading…
Reference in a new issue