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
+2
View File
@@ -168,6 +168,8 @@ export type CatalogueSearchResult = {
export type MusicRequest = {
id: string;
user_id: string;
// The requester's username. Only the admin list sends it.
username?: string;
status: RequestStatus;
kind: RequestKind;
artist_mbid: string;
+4 -5
View File
@@ -49,13 +49,12 @@
let rejectOpen = $state<string | null>(null);
let rejectNotes = $state<string>('');
// The id is a UUID — first 8 chars is plenty to disambiguate without a real
// username, and matches what the polish pass will replace with the real
// username surface.
// Names the requester. The id is the fallback for a list that came back
// without names; its first 8 characters are enough to tell users apart.
function rowMeta(r: MusicRequest): string {
const when = new Date(r.requested_at).toLocaleDateString();
const userBit = `by user ${r.user_id.slice(0, 8)}`;
return `${userBit} · ${when}`;
const who = r.username || `user ${r.user_id.slice(0, 8)}`;
return `by ${who} · ${when}`;
}
async function invalidate() {
@@ -125,4 +125,15 @@ describe('/admin/requests', () => {
]);
expect(screen.getByText(/wants the album/i)).toBeInTheDocument();
});
test('A row names who asked for it', () => {
setup([{ ...baseRow, username: 'alice' }]);
expect(screen.getByText(/^by alice · /)).toBeInTheDocument();
expect(screen.queryByText(/u1234567/)).not.toBeInTheDocument();
});
test('A row without a name falls back to the user id', () => {
setup();
expect(screen.getByText(/^by user u1234567 · /)).toBeInTheDocument();
});
});