Improves status template performance

Reduces queries about about 65
This commit is contained in:
Mouse Reeve
2021-05-22 18:34:34 -07:00
parent e5ff4ac36d
commit 7a4c4248df
8 changed files with 42 additions and 17 deletions

View File

@ -134,12 +134,14 @@
<span class="is-sr-only">{% trans "Notifications" %}</span>
</span>
</span>
{% with request.user.unread_notification_count as notification_count %}
<span
class="{% if not request.user.unread_notification_count %}is-hidden {% elif request.user.has_unread_mentions %}is-danger {% endif %}tag is-medium transition-x"
class="{% if not notification_count %}is-hidden {% elif request.user.has_unread_mentions %}is-danger {% endif %}tag is-medium transition-x"
data-poll-wrapper
>
<span data-poll="notifications">{{ request.user.unread_notification_count }}</span>
<span data-poll="notifications">{{ notification_count }}</span>
</span>
{% endwith %}
</a>
</div>
{% else %}