From 762f5cc411a3bec5644dd462b00eef168408ca41 Mon Sep 17 00:00:00 2001 From: padreug Date: Sat, 1 Nov 2025 09:25:22 +0100 Subject: [PATCH] Improves user display in audit log and requests Uses usernames instead of user IDs in the audit log and approval request listings to improve readability. If a user is not found, it displays a truncated version of the user ID. --- static/js/index.js | 4 ++++ templates/castle/index.html | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 746faf6..2517657 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -857,6 +857,10 @@ window.app = Vue.createApp({ const account = this.accounts.find(a => a.id === accountId) return account ? account.name : accountId }, + getUserName(userId) { + const user = this.users.find(u => u.user_id === userId) + return user ? user.username : userId.substring(0, 16) + '...' + }, async loadReconciliationSummary() { if (!this.isSuperUser) return diff --git a/templates/castle/index.html b/templates/castle/index.html index 5462904..b5d6a01 100644 --- a/templates/castle/index.html +++ b/templates/castle/index.html @@ -79,7 +79,7 @@ {% raw %}{{ formatDate(entry.entry_date) }}{% endraw %} - User: {% raw %}{{ entry.meta.user_id.substring(0, 16) }}...{% endraw %} + User: {% raw %}{{ getUserName(entry.meta.user_id) }}{% endraw %} Ref: {% raw %}{{ entry.reference }}{% endraw %} @@ -285,7 +285,7 @@ {% raw %}{{ request.description }}{% endraw %} - User: {% raw %}{{ request.user_id.substring(0, 16) }}...{% endraw %} + User: {% raw %}{{ getUserName(request.user_id) }}{% endraw %} Requested: {% raw %}{{ formatDate(request.created_at) }}{% endraw %}