fix(notification): allow clearing the sound on per-app overrides and main row

Previously, both the per-app override sound dropdown and the main
notification sound row only attached an EntitySelect when at least
one sound asset was registered — and never with allowNone. That left
users with no way to pick "no sound" once an entry existed, and made
the override dropdown silently inert before any assets were added.

Always construct the EntitySelect (so an empty assets list still
renders a usable, searchable input) and pass allowNone with the
localized none label so "no sound" is a first-class choice in both
the override list and the main row.
This commit is contained in:
2026-05-28 17:28:34 +03:00
parent 10eb24b2ce
commit 1f959932c1
@@ -233,15 +233,14 @@ function _overridesRenderList() {
// Wire EntitySelects for sound dropdowns // Wire EntitySelects for sound dropdowns
list.querySelectorAll<HTMLSelectElement>('.notif-override-sound').forEach(sel => { list.querySelectorAll<HTMLSelectElement>('.notif-override-sound').forEach(sel => {
const items = _getSoundAssetItems();
if (items.length > 0) {
const es = new EntitySelect({ const es = new EntitySelect({
target: sel, target: sel,
getItems: () => _getSoundAssetItems(), getItems: () => _getSoundAssetItems(),
placeholder: t('color_strip.notification.sound.search') || 'Search sounds…', placeholder: t('color_strip.notification.sound.search') || 'Search sounds…',
allowNone: true,
noneLabel: t('color_strip.notification.sound.none'),
}); });
_overrideEntitySelects.push(es); _overrideEntitySelects.push(es);
}
}); });
} }
@@ -300,14 +299,13 @@ export function ensureNotifSoundEntitySelect() {
if (!sel) return; if (!sel) return;
_populateSoundOptions(sel); _populateSoundOptions(sel);
if (_notifSoundEntitySelect) _notifSoundEntitySelect.destroy(); if (_notifSoundEntitySelect) _notifSoundEntitySelect.destroy();
const items = _getSoundAssetItems();
if (items.length > 0) {
_notifSoundEntitySelect = new EntitySelect({ _notifSoundEntitySelect = new EntitySelect({
target: sel, target: sel,
getItems: () => _getSoundAssetItems(), getItems: () => _getSoundAssetItems(),
placeholder: t('color_strip.notification.sound.search') || 'Search sounds…', placeholder: t('color_strip.notification.sound.search') || 'Search sounds…',
allowNone: true,
noneLabel: t('color_strip.notification.sound.none'),
}); });
}
} }
/* ── Test notification ────────────────────────────────────────── */ /* ── Test notification ────────────────────────────────────────── */