diff --git a/src/background.ts b/src/background.ts index c25caa9b..074a4138 100644 --- a/src/background.ts +++ b/src/background.ts @@ -586,6 +586,41 @@ async function resetThemeOfTheMonthDisabledFor366Upgrade( } } +/** 3.7.0: Close no longer marks entries seen — clear legacy dismissal keys. */ +const THEME_OF_THE_MONTH_RELOAD_VERSION = "3.7.0"; + +async function resetThemeOfTheMonthDismissalFor370Upgrade( + previousVersion: string, +): Promise { + try { + const currRaw = browser.runtime.getManifest().version; + const prev = semver.coerce(previousVersion); + const curr = semver.coerce(currRaw); + if ( + prev == null || + curr == null || + semver.lt(curr, THEME_OF_THE_MONTH_RELOAD_VERSION) || + !semver.lt(prev, THEME_OF_THE_MONTH_RELOAD_VERSION) + ) { + return; + } + + await browser.storage.local.set({ + themeOfTheMonthLastSeenId: undefined, + themeOfTheMonthDismissedMonth: undefined, + }); + + console.info( + `[BetterSEQTA+] Migration ${THEME_OF_THE_MONTH_RELOAD_VERSION}: Theme of the Month shows again until dismissed for the month (from ${previousVersion}).`, + ); + } catch (e) { + console.warn( + "[BetterSEQTA+] Theme of the Month 3.7.0 dismissal migration failed:", + e, + ); + } +} + browser.runtime.onInstalled.addListener(function (event) { browser.storage.local.remove(["justupdated"]); browser.storage.local.remove(["data"]); @@ -597,6 +632,7 @@ browser.runtime.onInstalled.addListener(function (event) { if (event.reason === "update" && event.previousVersion) { void migrateGlobalSearchDefaultsFor365Upgrade(event.previousVersion); void resetThemeOfTheMonthDisabledFor366Upgrade(event.previousVersion); + void resetThemeOfTheMonthDismissalFor370Upgrade(event.previousVersion); } }); diff --git a/src/seqta/utils/Openers/OpenThemeOfTheMonthPopup.ts b/src/seqta/utils/Openers/OpenThemeOfTheMonthPopup.ts index c6a609ac..03ac2e0b 100644 --- a/src/seqta/utils/Openers/OpenThemeOfTheMonthPopup.ts +++ b/src/seqta/utils/Openers/OpenThemeOfTheMonthPopup.ts @@ -45,10 +45,10 @@ export async function fetchThemeOfTheMonth(): Promise void, - markSeen = true, -) { +function closeThemeOfTheMonthCard(card: HTMLElement, onDismissed?: () => void) { if (card.classList.contains("themeOfTheMonthCardClosing")) return; - if (markSeen) { - const entryId = card.dataset.entryId; - if (entryId) settingsState.themeOfTheMonthLastSeenId = entryId; - } - card.classList.add("themeOfTheMonthCardClosing"); window.setTimeout(() => { card.remove(); @@ -165,7 +156,7 @@ export async function OpenThemeOfTheMonthPopup(