Hijax block button

This commit is contained in:
Jason McBrayer 2018-09-02 19:52:48 -04:00
parent 3e7c81fc02
commit 1dd8b1a316
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,15 @@
{% if not relationship.blocking %}
<a class="level-item fa fa-ban" title="block"
href="{% url 'block' user.id %}"
ic-post-to="{% url 'block' user.id %}"
ic-indicator="#user-spinner" ic-replace-target="true">
<span class="is-hidden">Block</span>
</a>
{% else %}
<a class="level-item fa fa-circle-o" title="unblock"
href="{% url 'block' user.id %}"
ic-post-to="{% url 'block' user.id %}"
ic-indicator="#user-spinner" ic-replace-target="true">
<span class="is-hidden">Unblock</span>
</a>
{% endif %}

View File

@ -652,7 +652,14 @@ def block(request, id):
mastodon.account_unblock(id)
else:
mastodon.account_block(id)
return redirect(user, user_dict.acct)
if request.POST.get('ic-request'):
relationship['blocking'] = not relationship['blocking']
return render(request, 'intercooler/block.html',
{"user": user_dict,
"relationship": relationship,
})
else:
return redirect(user, user_dict.acct)
else:
return render(request, 'main/block.html',
{"user": user_dict, "relationship": relationship,