fix: the admin requests list names who asked, not a cut-off user id (#6265)
release / govulncheck (push) Successful in 37s
release / web (push) Successful in 1m39s
release / go (push) Successful in 1m51s
release / integration (push) Failing after 5m37s
release / android (push) Successful in 5m54s
release / Build signed APK (releases and dev) (push) Successful in 5m57s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped

/admin/requests showed "by user f7e1ec86" — the first eight characters of
the requester's id, a placeholder from the first build. The admin list now
sends each requester's username, looked up for the whole page in one query,
and the row reads "by <username>". The id stays as the fallback for a list
that comes back without names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 20:43:18 -04:00
co-authored by Claude Opus 5.5
parent b9684e6d12
commit c98bd359f7
8 changed files with 83 additions and 7 deletions
+31
View File
@@ -388,6 +388,37 @@ func (q *Queries) ListActiveUsersWithTimezones(ctx context.Context) ([]ListActiv
return items, nil
}
const listUsernamesByIDs = `-- name: ListUsernamesByIDs :many
SELECT id, username FROM users WHERE id = ANY($1::uuid[])
`
type ListUsernamesByIDsRow struct {
ID pgtype.UUID
Username string
}
// Names a list's people in one round trip, e.g. who made each request on
// /admin/requests.
func (q *Queries) ListUsernamesByIDs(ctx context.Context, dollar_1 []pgtype.UUID) ([]ListUsernamesByIDsRow, error) {
rows, err := q.db.Query(ctx, listUsernamesByIDs, dollar_1)
if err != nil {
return nil, err
}
defer rows.Close()
var items []ListUsernamesByIDsRow
for rows.Next() {
var i ListUsernamesByIDsRow
if err := rows.Scan(&i.ID, &i.Username); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const listUsers = `-- name: ListUsers :many
SELECT id, username, display_name, is_admin, auto_approve_requests,
debug_mode_enabled, created_at