Add delete and block in the UI

This commit is contained in:
Thomas Sileo 2018-06-04 18:53:44 +02:00
parent c17a9a5a0c
commit d2e62ed5b6
2 changed files with 25 additions and 0 deletions

5
app.py
View file

@ -142,6 +142,11 @@ def quote_plus(t):
return urllib.parse.quote_plus(t) return urllib.parse.quote_plus(t)
@app.template_filter()
def is_from_outbox(t):
return t.startswith(ID)
@app.template_filter() @app.template_filter()
def clean(html): def clean(html):
return clean_html(html) return clean_html(html)

View file

@ -125,6 +125,26 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if session.logged_in %}
{% if item.activity.id | is_from_outbox %}
<form action="/api/note/delete" 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">delete</button>
</form>
{% else %}
<form action="/api/block" class="action-form" method="POST">
<input type="hidden" name="redirect" value="{{ redir }}">
<input type="hidden" name="actor" value="{{ item.activity.actor }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit" class="bar-item">block</button>
</form>
{% endif %}
{% endif %}
</div> </div>
{% if likes or shares %} {% if likes or shares %}