Add Announce support for the lookup

This commit is contained in:
Thomas Sileo 2018-07-29 20:10:15 +02:00
parent 45bfcc2502
commit 6cc30f622a
2 changed files with 17 additions and 1 deletions

11
app.py
View file

@ -1303,11 +1303,20 @@ def admin():
@login_required @login_required
def admin_lookup(): def admin_lookup():
data = None data = None
meta = None
if request.method == "POST": if request.method == "POST":
if request.form.get("url"): if request.form.get("url"):
data = lookup(request.form.get("url")) data = lookup(request.form.get("url"))
if data.has_type(ActivityType.ANNOUNCE):
meta = dict(
object=data.get_object().to_dict(),
object_actor=data.get_object().get_actor().to_dict(),
actor=data.get_actor().to_dict(),
)
return render_template("lookup.html", data=data, url=request.form.get("url")) return render_template(
"lookup.html", data=data, meta=meta, url=request.form.get("url")
)
@app.route("/admin/thread") @app.route("/admin/thread")

View file

@ -31,6 +31,13 @@
{{ utils.display_note(data.object, ui=True) }} {{ utils.display_note(data.object, ui=True) }}
{% elif data | has_type('Note') %} {% elif data | has_type('Note') %}
{{ utils.display_note(data, ui=True) }} {{ utils.display_note(data, ui=True) }}
{% elif data | has_type('Announce') %}
{% set boost_actor = meta.actor %}
<p style="margin-left:65px;padding-bottom:5px;">
<span class="bar-item-no-hover"><a style="color:#808080;" href="{{ boost_actor.url | get_url }}">{{ boost_actor.name }}</a> boosted</span>
</p>
{{ utils.display_note(meta.object, ui=False, meta={'actor': meta.object_actor}) }}
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}