From 2bf0ddb0748ca15ec20c5608edcfb1af5ea9dc26 Mon Sep 17 00:00:00 2001 From: double beep <38133098+double-beep@users.noreply.github.com> Date: Wed, 21 Aug 2024 07:37:39 +0000 Subject: [PATCH] fix: add post icons and watch for flags even if `linkDisabled` is `true` --- src/AdvancedFlagging.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/AdvancedFlagging.ts b/src/AdvancedFlagging.ts index ded85f4..e79adbe 100644 --- a/src/AdvancedFlagging.ts +++ b/src/AdvancedFlagging.ts @@ -157,9 +157,7 @@ function setPopoverOpening( export let page = new Page(); function setupPostPage(): void { - // check if the link + popover should be set up - const linkDisabled = Store.config[Cached.Configuration.linkDisabled]; - if (linkDisabled || Page.isLqpReviewPage) return; // do not add the buttons on review + if (Page.isLqpReviewPage) return; // do not add the buttons on review // split setup into two parts: // i) append the icons to iconLocation @@ -173,10 +171,20 @@ function setupPostPage(): void { return; } + const linkDisabled = Store.config[Cached.Configuration.linkDisabled]; + page.posts.forEach(post => { const { id, done, failed, flagged, element } = post; + // even if the user chose to disable AF link, + // the script should still watch for post flags + // and append icons post.watchForFlags(); + if (linkDisabled) { + post.addIcons(); + + return; + } // Now append the advanced flagging dropdown const advancedFlaggingLink = Buttons.makeStacksButton(