From 4d1a8f5f93449925e02500814e4c5829d8a00670 Mon Sep 17 00:00:00 2001 From: ttys0dev <126845556+ttys0dev@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:43:08 -0600 Subject: [PATCH] Fix setDefaultOptions in updateToolbarButton --- CHANGES.md | 1 + src/utils/toolbar_button.js | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f6585295..b4427e96 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Fixes: - Corrected typo in build script, ensuring correct favicon path for Firefox releases([379](https://github.com/freelawproject/recap/issues/379), [397](https://github.com/freelawproject/recap-chrome/pull/397)) - Refines the generateFileName method to accurately compute zip file names ([366](https://github.com/freelawproject/recap/issues/366), [399](https://github.com/freelawproject/recap-chrome/pull/399)). - Improves the reliability of PACER case ID retrieval on attachment pages ([369](https://github.com/freelawproject/recap/issues/369), [400](https://github.com/freelawproject/recap-chrome/pull/400)). + - Fix setDefaultOptions in updateToolbarButton([403](https://github.com/freelawproject/recap-chrome/pull/403)) For developers: diff --git a/src/utils/toolbar_button.js b/src/utils/toolbar_button.js index cf94452b..a8bf12c2 100644 --- a/src/utils/toolbar_button.js +++ b/src/utils/toolbar_button.js @@ -31,6 +31,13 @@ export function updateToolbarButton(tab) { }; chrome.storage.local.get('options', function (items) { + if (!Object.keys(items).length) { + // Firefox 56 bug. The default settings didn't get created properly when + // upgrading from the legacy extension. This can be removed when everybody + // is safely beyond 56 (and the ESR) + setDefaultOptions({}); + } + if ( 'dismiss_news_badge' in items['options'] && items['options']['dismiss_news_badge'] @@ -52,12 +59,6 @@ export function updateToolbarButton(tab) { }); return; } - if (!Object.keys(items).length) { - // Firefox 56 bug. The default settings didn't get created properly when - // upgrading from the legacy extension. This can be removed when everybody - // is safely beyond 56 (and the ESR) - setDefaultOptions({}); - } if (items && items['options'] && !items['options']['recap_enabled']) { setTitleIcon('RECAP is temporarily disabled', {