From f4c1b264c6b02646a47caa9fa36815a9a9197e48 Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Wed, 10 Jun 2026 23:26:53 +0900 Subject: [PATCH] Email reminder bell: re-evaluate visibility live on settings change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bell is already gated on settings.reminder_channel === 'email', but the check only ran at email-library init — so switching the reminder channel in Settings didn't update the bell until you reopened Email. - Settings/Reminders channel-change handler now dispatches odysseus-reminder-channel-changed { channel } after saving. - emailLibrary listens for it and re-runs _syncEmailReminderBellVisibility with the new channel value. --- static/js/emailLibrary.js | 6 ++++++ static/js/settings.js | 3 +++ 2 files changed, 9 insertions(+) diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index 34c8e2cd6..3747db411 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -321,6 +321,12 @@ async function _loadEmailReminderBellVisibility() { _syncEmailReminderBellVisibility(false); } } +// Live-update the bell when the reminder channel changes in Settings, +// so the user doesn't have to reopen Email to see the change apply. +window.addEventListener('odysseus-reminder-channel-changed', (e) => { + const ch = e?.detail?.channel; + _syncEmailReminderBellVisibility(ch === 'email'); +}); function _readCssPx(name) { const v = getComputedStyle(document.documentElement).getPropertyValue(name); diff --git a/static/js/settings.js b/static/js/settings.js index 5c44b299c..2dbfd3f4b 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -2645,6 +2645,9 @@ async function initReminderSettings() { if (hint) hint.textContent = CHANNEL_HINTS[channelSel.value] || ''; syncChannelRows(); save({ reminder_channel: channelSel.value }); + // Email reminder bell visibility tracks this — broadcast so the + // email library can re-evaluate without waiting for a re-open. + try { window.dispatchEvent(new CustomEvent('odysseus-reminder-channel-changed', { detail: { channel: channelSel.value } })); } catch (_) {} }); if (emailToIn) { let emailDebounce;