From 3a6795be0a8d768b4b860469155c7eb6cb4c1211 Mon Sep 17 00:00:00 2001
From: Maximilian Moser <maximilian.moser@tuwien.ac.at>
Date: Wed, 12 Mar 2025 12:09:14 +0100
Subject: [PATCH] Reverse order of listed users on the admin endpoint

* because most of the time we want to manage the new accounts, which of
  course have the highest IDs
---
 CHANGES.rst                | 5 +++++
 invenio_theme_tuw/utils.py | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/CHANGES.rst b/CHANGES.rst
index 6d5bd86..b501665 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -9,6 +9,11 @@ Changes
 =======
 
 
+Version <next>
+
+- Reverse order of listed users on admin endpoint
+
+
 Version v2025.1.9 (released 2025-03-11)
 
 - Always show the link to the record for `rdm-curation` requests
diff --git a/invenio_theme_tuw/utils.py b/invenio_theme_tuw/utils.py
index 214c965..a580dac 100644
--- a/invenio_theme_tuw/utils.py
+++ b/invenio_theme_tuw/utils.py
@@ -46,7 +46,7 @@ def fetch_user_infos():
     user_infos = []
     trusted_user_role = current_datastore.find_role("trusted-user")
 
-    for user in db.session.query(User).order_by(User.id).all():
+    for user in db.session.query(User).order_by(User.id.desc()).all():
         # check if the user has given us consent for record curation
         curation_consent = (user.preferences or {}).get("curation_consent", False)
 
-- 
GitLab