fix(collab): read username from session.claims.username instead of session.username

The encryptid session stores username at claims.username, not at the
top level. Also falls back to the rspace-username localStorage key
that rstack-identity sets on login.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-24 18:03:01 -07:00
parent 3f496d9fc6
commit efa5a5c315
1 changed files with 7 additions and 2 deletions

View File

@ -241,8 +241,13 @@ export class RStackCollabOverlay extends HTMLElement {
const raw = localStorage.getItem('encryptid_session');
if (raw) {
const session = JSON.parse(raw);
if (session?.username) this.#localUsername = session.username;
else if (session?.displayName) this.#localUsername = session.displayName;
if (session?.claims?.username) this.#localUsername = session.claims.username;
else if (session?.username) this.#localUsername = session.username;
}
// Fallback: rstack-identity also stores username separately
if (this.#localUsername === 'Anonymous') {
const stored = localStorage.getItem('rspace-username');
if (stored) this.#localUsername = stored;
}
} catch { /* no session */ }
}