From 5a12b9e6c45dd7a8aff5d54461382e6450081a9f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 24 Jul 2021 16:47:41 +0100 Subject: [PATCH] Fix crash in releases list due to missing `current_user` argument --- app/templates/macros/releases.html | 74 +++++++++++------------ app/templates/packages/releases_list.html | 2 +- app/templates/packages/view.html | 2 +- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/app/templates/macros/releases.html b/app/templates/macros/releases.html index 697e9b6d..c477e582 100644 --- a/app/templates/macros/releases.html +++ b/app/templates/macros/releases.html @@ -24,7 +24,7 @@ {% endmacro %} -{% macro render_releases_download(releases, package) %} +{% macro render_releases_download(releases, package, current_user) %} {% for rel in releases %} {% if rel.approved or package.checkPerm(current_user, "MAKE_RELEASE") or rel.checkPerm(current_user, "APPROVE_RELEASE") %} @@ -54,48 +54,46 @@ {% macro render_releases(releases, package, current_user) -%} {% for rel in releases %} - {% if rel.approved or package.checkPerm(current_user, "MAKE_RELEASE") or rel.checkPerm(current_user, "APPROVE_RELEASE") %} -
- Edit - {% if not rel.task_id and not rel.approved and rel.checkPerm(current_user, "APPROVE_RELEASE") %} - / Approve +
+ Edit + {% if not rel.task_id and not rel.approved and rel.checkPerm(current_user, "APPROVE_RELEASE") %} + / Approve + {% endif %} + + + {% if not rel.approved %}{% endif %} + + + {{ rel.title }} + + + + {% if rel.min_rel and rel.max_rel %} + [MT {{ rel.min_rel.name }}-{{ rel.max_rel.name }}] + {% elif rel.min_rel %} + [MT {{ rel.min_rel.name }}+] + {% elif rel.max_rel %} + [MT ≤{{ rel.max_rel.name }}] {% endif %} - + - {% if not rel.approved %}{% endif %} +
- - {{ rel.title }} - - - - {% if rel.min_rel and rel.max_rel %} - [MT {{ rel.min_rel.name }}-{{ rel.max_rel.name }}] - {% elif rel.min_rel %} - [MT {{ rel.min_rel.name }}+] - {% elif rel.max_rel %} - [MT ≤{{ rel.max_rel.name }}] - {% endif %} - - -
- - - {% if rel.commit_hash %} - [{{ rel.commit_hash | truncate(5, end='') }}] - {% endif %} - - created {{ rel.releaseDate | date }}. - - {% if (package.checkPerm(current_user, "MAKE_RELEASE") or rel.checkPerm(current_user, "APPROVE_RELEASE")) and rel.task_id %} - Importing... - {% elif not rel.approved %} - Waiting for approval. + + {% if rel.commit_hash %} + [{{ rel.commit_hash | truncate(5, end='') }}] {% endif %} - {% if not rel.approved %}
{% endif %} -
- {% endif %} + created {{ rel.releaseDate | date }}. + + {% if (package.checkPerm(current_user, "MAKE_RELEASE") or rel.checkPerm(current_user, "APPROVE_RELEASE")) and rel.task_id %} + Importing... + {% elif not rel.approved %} + Waiting for approval. + {% endif %} + + {% if not rel.approved %}{% endif %} +
{% else %}
No releases available.
{% endfor %} diff --git a/app/templates/packages/releases_list.html b/app/templates/packages/releases_list.html index 23019b66..1cfdcb7c 100644 --- a/app/templates/packages/releases_list.html +++ b/app/templates/packages/releases_list.html @@ -38,7 +38,7 @@ {% if package.checkPerm(current_user, "MAKE_RELEASE") %} {{ render_releases_edit(package.releases, package) }} {% else %} - {{ render_releases_download(package.releases, package) }} + {{ render_releases_download(package.releases, package, current_user) }} {% endif %} {% endblock %} diff --git a/app/templates/packages/view.html b/app/templates/packages/view.html index cbae22b8..62821efe 100644 --- a/app/templates/packages/view.html +++ b/app/templates/packages/view.html @@ -431,7 +431,7 @@ {% if package.checkPerm(current_user, "MAKE_RELEASE") %} {{ render_releases(releases, package, current_user) }} {% else %} - {{ render_releases_download(releases, package) }} + {{ render_releases_download(releases, package, current_user) }} {% endif %} More