From da7549eedac7d5585eb170253823c428159b2b66 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 28 Mar 2026 18:06:14 -0700 Subject: [PATCH] Show actual user data on the edit page. --- platform/user.go | 6 +- ts/store/users.ts | 7 +- ts/view/configuration/UserEdit.vue | 203 +++++++++++++---------------- 3 files changed, 102 insertions(+), 114 deletions(-) diff --git a/platform/user.go b/platform/user.go index c77b87d6..2a3c7184 100644 --- a/platform/user.go +++ b/platform/user.go @@ -23,8 +23,9 @@ type NoUserError struct{} func (e NoUserError) Error() string { return "That user does not exist" } type User struct { + Active bool `json:"active"` DisplayName string `json:"display_name"` - ID int `json:"-"` + ID int `json:"id"` Initials string `json:"initials"` Notifications []Notification `json:"notifications"` NotificationCounts UserNotificationCounts `json:"notification_counts"` @@ -32,6 +33,7 @@ type User struct { PasswordHash string `json:"-"` PasswordHashType string `json:"-"` Role string `json:"role"` + Tags []string `json:"tags"` URI string `json:"uri"` Username string `json:"username"` @@ -50,6 +52,7 @@ func (u User) HasRoot() bool { } func newUser(ctx context.Context, org Organization, user *models.User) User { u := User{ + Active: true, DisplayName: user.DisplayName, ID: int(user.ID), Initials: extractInitials(user.DisplayName), @@ -59,6 +62,7 @@ func newUser(ctx context.Context, org Organization, user *models.User) User { PasswordHash: user.PasswordHash, PasswordHashType: string(user.PasswordHashType), Role: user.Role.String(), + Tags: []string{}, URI: fmt.Sprintf("/user/%d", user.ID), Username: user.Username, diff --git a/ts/store/users.ts b/ts/store/users.ts index 3c4f31ae..33bfb12c 100644 --- a/ts/store/users.ts +++ b/ts/store/users.ts @@ -19,9 +19,11 @@ export const useUsersStore = defineStore("users", () => { }); // Actions function byID(id: int) { - return _byID.value.get(id); + const result = _byID.value.get(id); + console.log("user", id, result); + return result; } - async function fetchAll() { + async function fetchAll(): Promise { const userStore = useUserStore(); if (userStore.urls == null) { throw new Error("can't fetch without user URL data"); @@ -44,6 +46,7 @@ export const useUsersStore = defineStore("users", () => { for (const u of data.users) { _byID.value.set(u.id, u); } + return data.users; } catch (err) { console.error("Error loading users:", err); throw err; diff --git a/ts/view/configuration/UserEdit.vue b/ts/view/configuration/UserEdit.vue index 4468ec4a..6836a038 100644 --- a/ts/view/configuration/UserEdit.vue +++ b/ts/view/configuration/UserEdit.vue @@ -40,7 +40,7 @@ pre {

User Configuration

-
+
@@ -88,7 +88,7 @@ pre {
-
- - -
-
-
Preview
-
-
-
{{ user }}
+
+

loading

@@ -246,8 +239,9 @@ pre {
-