mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Display threads locally when possible
This commit is contained in:
parent
d8f7967e6a
commit
0a53cba5f5
2 changed files with 27 additions and 7 deletions
17
app.py
17
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():
|
||||
|
|
|
@ -64,18 +64,21 @@
|
|||
{% else %}
|
||||
<a class ="bar-item" href="{{ obj.url }}">permalink</a>
|
||||
|
||||
{% if meta.count_reply %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_reply }}</strong> replies</a>{% endif %}
|
||||
{% if meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_boost }}</strong> boosts</a>{% endif %}
|
||||
{% if meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_like }}</strong> likes</a>{% 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 %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_reply }}</strong> replies</a>
|
||||
{% elif meta.count_reply and session.logged_in %}
|
||||
<a class ="bar-item" href="/admin/thread?oid={{aid}}"><strong>{{ meta.count_reply }}</strong> replies</a>{% endif %}
|
||||
|
||||
{% if meta.count_boost and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_boost }}</strong> boosts</a>{% endif %}
|
||||
{% if meta.count_like and obj.id | is_from_outbox %}<a class ="bar-item" href="{{ obj.url }}"><strong>{{ meta.count_like }}</strong> likes</a>{% endif %}
|
||||
|
||||
{% if session.logged_in %}
|
||||
{% if ui%}
|
||||
|
||||
<a class="bar-item" href="/admin/new?reply={{ aid }}">reply</a>
|
||||
{% if meta.boosted %}
|
||||
|
@ -112,7 +115,6 @@
|
|||
|
||||
{% endif %}
|
||||
|
||||
{% if session.logged_in %}
|
||||
{% if obj.id | is_from_outbox %}
|
||||
<form action="/api/note/delete" class="action-form" method="POST">
|
||||
<input type="hidden" name="redirect" value="{{ redir }}">
|
||||
|
@ -130,6 +132,7 @@
|
|||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue