make the boost/unboost actions use the new user API

This commit is contained in:
Thomas Sileo 2018-06-03 12:15:30 +02:00
parent 4d72a1b16b
commit 8b166633c9

View file

@ -62,19 +62,32 @@
<div class="bottom-bar"> <div class="bottom-bar">
{% if perma %}<span class="perma-item">{{ item.activity.object.published | format_time }}</span> {% endif %} {% if perma %}<span class="perma-item">{{ item.activity.object.published | format_time }}</span> {% endif %}
<a class ="bar-item" href="{{ item.activity.object.url }}">permalink</a> <a class ="bar-item" href="{{ item.activity.object.url }}">permalink</a>
{% if item.meta.count_reply %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_reply }} replies</a>{% endif %} {% if item.meta.count_reply %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_reply }} replies</a>{% endif %}
{% if item.meta.count_boost %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_boost }} boosts</a>{% endif %} {% if item.meta.count_boost %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_boost }} boosts</a>{% endif %}
{% if item.meta.count_like %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_like }} likes</a>{% endif %} {% if item.meta.count_like %}<a class ="bar-item" href="{{ item.activity.object.url }}">{{ item.meta.count_like }} likes</a>{% endif %}
{% if ui %} {% if ui %}
{% set aid = item.activity.object.id | quote_plus %} {% set aid = item.activity.object.id | quote_plus %}
<a class="bar-item" href="/new?reply={{ aid }}">reply</a> <a class="bar-item" href="/new?reply={{ aid }}">reply</a>
{% set redir = request.path + "#activity-" + item['_id'].__str__() %} {% set redir = request.path + "#activity-" + item['_id'].__str__() %}
{% if item.meta.boosted %} {% if item.meta.boosted %}
<a class="bar-item" href="/ui/undo?id={{ item.meta.boosted | quote_plus }}&redirect={{redir | quote_plus }}">unboost</a> <form action="/api/undo" class="action-form" method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ item.meta.boosted }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">unboost</button>
</form>
{% else %} {% else %}
<a class="bar-item" href="/ui/boost?id={{ aid }}&redirect={{ redir | quote_plus }}">boost</a> <form action="/api/boost" class="action-form" method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="id" value="{{ item.activity.object.id }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">boost</button>
</form>
{% endif %} {% endif %}
{% if item.meta.liked %} {% if item.meta.liked %}