From 8ff25e6034ff31918984cd19b5dd3abc270d388d Mon Sep 17 00:00:00 2001 From: imperosol Date: Mon, 29 Sep 2025 08:45:42 +0200 Subject: [PATCH] optimize main page notifications --- core/templates/core/base/header.jinja | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core/templates/core/base/header.jinja b/core/templates/core/base/header.jinja index 87453d22..cb47a47c 100644 --- a/core/templates/core/base/header.jinja +++ b/core/templates/core/base/header.jinja @@ -77,22 +77,22 @@
- {% set notification_count = user.notifications.filter(viewed=False).count() %} + {% set notifications = user.notifications.filter(viewed=False).order_by("-date")|list %} - {% if notification_count > 0 %} + {%- if notifications|length > 0 -%} - {% if notification_count < 100 %} - {{ notification_count }} - {% else %} -   - {% endif %} + {% if notifications|length < 100 %} + {{ notifications|length }} + {%- else -%} + 99+ + {%- endif -%} {% endif %}
    - {% if user.notifications.filter(viewed=False).count() > 0 %} - {% for n in user.notifications.filter(viewed=False).order_by('-date') %} + {%- if notifications|length > 0 -%} + {%- for n in notifications -%}
  • @@ -108,10 +108,10 @@
  • - {% endfor %} - {% else %} + {%- endfor -%} + {%- else -%}
  • {% trans %}You do not have any unread notification{% endtrans %}
  • - {% endif %} + {%- endif -%}