Omit the empty email line in the toolbar account menu

Temporary accounts and saved accounts without an email rendered an empty
element, adding a stray gap under the username.
This commit is contained in:
jelveh committed 2026-10-01 22:21:09 -07:00
1 parent c328283fa7
commit 654cee36c3
2 files changed
+11 -2

No files matched your search

@@ -294,6 +294,15 @@ describe('embedded toolbar', () => {
} finally { await context.close(); }
});
it('omits the email line for accounts without one', async () => {
const { context, toolbar } = await openToolbar();
try {
await toolbar.getByRole('button', { name: 'Account', exact: true }).click();
await toolbar.getByText('first@example.test').waitFor();
expect(await toolbar.locator('[data-account="0"] small').count()).toBe(0);
} finally { await context.close(); }
});
it('labels controls with translated text encoded once', async () => {
const { context, toolbar } = await openToolbar(undefined, sessionToken, [{ name: 'user_preferences', value: '{"language":"de"}' }]);
try {
+2 -2
View File
@@ -75,8 +75,8 @@ function showPanel (next) {
});
} else {
const accounts = readSavedAccounts().filter(account => account.uuid !== user.uuid);
$content.html(`<div class="toolbar-account-content"><div class="toolbar-current"><strong>${escape(user.username)}</strong><span>${escape(user.email)}</span></div>
<div class="toolbar-accounts">${accounts.map((account, index) => `<button type="button" class="toolbar-account" data-account="${index}"><span class="toolbar-avatar">${escape(account.username[0]?.toUpperCase())}</span><span><strong>${escape(account.username)}</strong><small>${escape(account.email)}</small></span></button>`).join('')}</div>
$content.html(`<div class="toolbar-account-content"><div class="toolbar-current"><strong>${escape(user.username)}</strong>${user.email ? `<span>${escape(user.email)}</span>` : ''}</div>
<div class="toolbar-accounts">${accounts.map((account, index) => `<button type="button" class="toolbar-account" data-account="${index}"><span class="toolbar-avatar">${escape(account.username[0]?.toUpperCase())}</span><span><strong>${escape(account.username)}</strong>${account.email ? `<small>${escape(account.email)}</small>` : ''}</span></button>`).join('')}</div>
<a class="toolbar-item" href="/action/login" target="_blank" rel="noopener noreferrer">${i18n('toolbar_add_account')}</a>
<a class="toolbar-item" href="/dashboard#account" target="_blank" rel="noopener noreferrer">${i18n('toolbar_settings')}</a>
<button type="button" class="toolbar-item toolbar-logout">${i18n('log_out')}</button>