From bb371a58e53a36cd1c3345124e5df5ddd12380d1 Mon Sep 17 00:00:00 2001 From: Erin Date: Sun, 24 Dec 2023 13:08:44 -0500 Subject: [PATCH] comments: Await modbar before adding removed comment hider (#872) --- extension/data/modules/comment.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extension/data/modules/comment.js b/extension/data/modules/comment.js index d32aba12d..40793843d 100644 --- a/extension/data/modules/comment.js +++ b/extension/data/modules/comment.js @@ -7,6 +7,7 @@ import TBListener from '../tblistener.js'; import {Module} from '../tbmodule.js'; import * as TBStorage from '../tbstorage.js'; import * as TBui from '../tbui.js'; +import {modbarExists} from './modbar.js'; const self = new Module({ name: 'Comments', @@ -84,10 +85,14 @@ self.initOldReddit = async function ({hideRemoved, approveComments, spamRemoved, self.spamRemoved = spamRemoved; self.hamSpammed = hamSpammed; - function run () { + async function run () { // // Do stuff with removed comments // + + // Wait for the modbar to be on the page before we attempt to add to it + await modbarExists; + // Show a removed comments counter when visiting a comment page on a sub where you are moderator. When hiding of removed comments is enabled this doubles as a toggle for that. let removedCounter = 0;