Add debug logs

This commit is contained in:
Thomas Sileo 2018-08-01 08:29:08 +02:00
parent 29a2cc23ff
commit 53e5a9e237

4
app.py
View file

@ -939,6 +939,7 @@ def note_by_id(note_id):
if data["meta"].get("deleted", False): if data["meta"].get("deleted", False):
abort(410) abort(410)
thread = _build_thread(data) thread = _build_thread(data)
app.logger.info(f"thread={thread!r}")
likes = list( likes = list(
DB.activities.find( DB.activities.find(
@ -947,6 +948,7 @@ def note_by_id(note_id):
"meta.deleted": False, "meta.deleted": False,
"type": ActivityType.LIKE.value, "type": ActivityType.LIKE.value,
"$or": [ "$or": [
# FIXME(tsileo): remove all the useless $or
{"activity.object.id": data["activity"]["object"]["id"]}, {"activity.object.id": data["activity"]["object"]["id"]},
{"activity.object": data["activity"]["object"]["id"]}, {"activity.object": data["activity"]["object"]["id"]},
], ],
@ -954,6 +956,7 @@ def note_by_id(note_id):
) )
) )
likes = [doc["meta"]["actor"] for doc in likes] likes = [doc["meta"]["actor"] for doc in likes]
app.logger.info(f"likes={likes!r}")
shares = list( shares = list(
DB.activities.find( DB.activities.find(
@ -969,6 +972,7 @@ def note_by_id(note_id):
) )
) )
shares = [doc["meta"]["actor"] for doc in shares] shares = [doc["meta"]["actor"] for doc in shares]
app.logger.info(f"shares={shares!r}")
return render_template( return render_template(
"note.html", likes=likes, shares=shares, thread=thread, note=data "note.html", likes=likes, shares=shares, thread=thread, note=data