From 543a42425898cdff382ed9c9a22cf4fa29ba4a87 Mon Sep 17 00:00:00 2001 From: imperosol Date: Mon, 29 Sep 2025 16:10:50 +0200 Subject: [PATCH] fix: N+1 on news list for admins --- com/templates/com/macros.jinja | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/com/templates/com/macros.jinja b/com/templates/com/macros.jinja index 1e3fb853..233f8cd4 100644 --- a/com/templates/com/macros.jinja +++ b/com/templates/com/macros.jinja @@ -76,18 +76,20 @@ It will stay hidden for other users until it has been published. {% endtrans %}

- {% if user.has_perm("com.moderate_news") %} + {%- if user.has_perm("com.moderate_news") -%} {# This is an additional query for each non-moderated news, but it will be executed only for admin users, and only one time - (if they do their job and moderated news as soon as they see them), + (if they do their job and moderate news as soon as they see them), so it's still reasonable #}