Separate vars for user count and display counts

This commit is contained in:
Mouse Reeve 2022-07-05 14:25:42 -07:00
parent 8cbf8f62c7
commit 7508ae9eae
4 changed files with 31 additions and 13 deletions

View file

@ -34,7 +34,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others boosted your <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others boosted your <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -57,7 +57,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others boosted your <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others boosted your <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -80,7 +80,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others boosted your <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others boosted your <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -103,7 +103,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others boosted your <a href="{{ related_path }}">status</a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others boosted your <a href="{{ related_path }}">status</a>
{% endblocktrans %}
{% endif %}

View file

@ -34,7 +34,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others liked your <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others liked your <a href="{{ related_path }}">review of <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -57,7 +57,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others liked your <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others liked your <a href="{{ related_path }}">comment on <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -80,7 +80,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others liked your <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others liked your <a href="{{ related_path }}">quote from <em>{{ book_title }}</em></a>
{% endblocktrans %}
{% endif %}
@ -103,7 +103,7 @@
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_count }} others liked your <a href="{{ related_path }}">status</a>
<a href="{{ related_user_link }}">{{ related_user }}</a> and {{ other_user_display_count }} others liked your <a href="{{ related_path }}">status</a>
{% endblocktrans %}
{% endif %}

View file

@ -12,6 +12,21 @@
{% endblock %}
{% block description %}
{% trans "followed you" %}
{% include 'snippets/follow_button.html' with user=notification.related_user %}
{% if related_user_count == 1 %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> followed you
{% endblocktrans %}
{% elif related_user_count == 2 %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a> and
<a href="{{ second_user_link }}">{{ second_user }}</a> followed you
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
<a href="{{ related_user_link }}">{{ related_user }}</a>,
<a href="{{ second_user_link }}">{{ second_user }}</a>, and {{ other_user_display_count }} users followed you
{% endblocktrans %}
{% endif %}
{% endblock %}

View file

@ -3,6 +3,7 @@
{% related_status notification as related_status %}
{% with related_users=notification.related_users.all %}
{% with related_user_count=notification.related_users.count %}
<div class="notification {% if notification.id in unread %}has-background-primary{% endif %}">
<div class="columns is-mobile {% if notification.id in unread %}has-text-white{% else %}has-text-more-muted{% endif %}">
<div class="column is-narrow is-size-3">
@ -12,7 +13,7 @@
</div>
<div class="column is-clipped">
{% if notification.related_users.count > 1 %}
{% if related_user_count > 1 %}
<div class="block">
<ul class="is-flex">
{% for user in related_users|slice:10 %}
@ -27,7 +28,7 @@
{% endif %}
<div class="block content">
<p>
{% if notification.related_users.count == 1 %}
{% if related_user_count == 1 %}
{% with user=related_users.first %}
{% spaceless %}
<a href="{{ user.local_path }}" class="mr-2">
@ -41,13 +42,15 @@
{% with related_user_link=related_users.first.local_path %}
{% with second_user=related_users.all.1.display_name %}
{% with second_user_link=related_users.all.1.local_path %}
{% with other_user_count=notification.related_users.count|add:"-1"|intcomma %}
{% with other_user_count=related_user_count|add:"-1" %}
{% with other_user_display_count=other_user_count|intcomma %}
{% block description %}{% endblock %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endwith %}
</p>
</div>