Refactors block button for query efficiency
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
{% load i18n %}
|
||||
{% if not user in request.user.blocks.all %}
|
||||
{% if not blocks %}
|
||||
<form name="blocks" method="post" action="/block/{{ user.id }}">
|
||||
{% csrf_token %}
|
||||
<button class="button is-danger is-light is-small {{ class }}" type="submit">{% trans "Block" %}</button>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% load i18n %}
|
||||
{% if request.user == user or not request.user.is_authenticated %}
|
||||
{% elif user in request.user.blocks.all %}
|
||||
{% include 'snippets/block_button.html' %}
|
||||
{% include 'snippets/block_button.html' with blocks=True %}
|
||||
{% else %}
|
||||
|
||||
<div class="field{% if not minimal %} has-addons{% else %} mb-0{% endif %}">
|
||||
|
@ -39,7 +39,7 @@
|
||||
{% include 'snippets/report_button.html' with user=status.user status=status %}
|
||||
</li>
|
||||
<li role="menuitem" class="dropdown-item p-0">
|
||||
{% include 'snippets/block_button.html' with user=status.user class="is-fullwidth" %}
|
||||
{% include 'snippets/block_button.html' with user=status.user class="is-fullwidth" blocks=False %}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -16,6 +16,6 @@
|
||||
{% include 'snippets/report_button.html' with user=user class="is-fullwidth" %}
|
||||
</li>
|
||||
<li role="menuitem">
|
||||
{% include 'snippets/block_button.html' with user=user class="is-fullwidth" %}
|
||||
{% include 'snippets/block_button.html' with user=user class="is-fullwidth" blocks=False %}
|
||||
</li>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user