From 0a53cba5f57fa31abcd3b4b5da76f1859ac92c41 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sat, 14 Jul 2018 12:29:46 +0200 Subject: [PATCH] Display threads locally when possible --- app.py | 17 +++++++++++++++++ templates/utils.html | 17 ++++++++++------- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index d431bc1..ec77748 100644 --- a/app.py +++ b/app.py @@ -1168,6 +1168,23 @@ def admin(): ) +@app.route("/admin/thread") +@login_required +def admin_thread(): + data = DB.activities.find_one( + {"$or": [{"remote_id": request.args.get("oid")}, {"activity.object.id": request.args.get("oid")}]} + ) + if not data: + abort(404) + if data["meta"].get("deleted", False): + abort(410) + thread = _build_thread(data) + + return render_template( + "note.html", thread=thread, note=data + ) + + @app.route("/admin/new", methods=["GET"]) @login_required def admin_new(): diff --git a/templates/utils.html b/templates/utils.html index d0858b1..f2893d1 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -64,18 +64,21 @@ {% else %} permalink -{% if meta.count_reply %}{{ meta.count_reply }} replies{% endif %} -{% if meta.count_boost and obj.id | is_from_outbox %}{{ meta.count_boost }} boosts{% endif %} -{% if meta.count_like and obj.id | is_from_outbox %}{{ meta.count_like }} likes{% endif %} -{% endif %} - {% if session.logged_in %} {% set perma_id = obj.id | permalink_id %} {% set redir = request.path + "#activity-" + perma_id %} {% set aid = obj.id | quote_plus %} {% endif %} -{% if ui and session.logged_in %} +{% if meta.count_reply and obj.id | is_from_outbox %}{{ meta.count_reply }} replies +{% elif meta.count_reply and session.logged_in %} +{{ meta.count_reply }} replies{% endif %} + +{% if meta.count_boost and obj.id | is_from_outbox %}{{ meta.count_boost }} boosts{% endif %} +{% if meta.count_like and obj.id | is_from_outbox %}{{ meta.count_like }} likes{% endif %} + +{% if session.logged_in %} +{% if ui%} reply {% if meta.boosted %} @@ -112,7 +115,6 @@ {% endif %} -{% if session.logged_in %} {% if obj.id | is_from_outbox %}
@@ -130,6 +132,7 @@ {% endif %} {% endif %} +{% endif %}