diff --git a/Plugins/OldTitleBar/OldTitleBar.plugin.js b/Plugins/OldTitleBar/OldTitleBar.plugin.js index 6d6b7b144c..2776ab26a0 100644 --- a/Plugins/OldTitleBar/OldTitleBar.plugin.js +++ b/Plugins/OldTitleBar/OldTitleBar.plugin.js @@ -184,7 +184,7 @@ var OldTitleBar = (_ => { if (this.SettingsUpdated) { delete this.SettingsUpdated; - BDFDB.ModuleUtils.forceAllUpdates(this); + this.forceUpdateAll(); } } diff --git a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js index 322ce19b84..a9b70014e3 100644 --- a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js +++ b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js @@ -159,7 +159,7 @@ var ReadAllNotificationsButton = (_ => { let loadedBlacklist = BDFDB.DataUtils.load(this, "blacklist"); this.saveBlacklist(!BDFDB.ArrayUtils.is(loadedBlacklist) ? [] : loadedBlacklist); - BDFDB.ModuleUtils.forceAllUpdates(this); + this.forceUpdateAll(); } else console.error(`%c[${this.getName()}]%c`, "color: #3a71c1; font-weight: 700;", "", "Fatal Error: Could not load BD functions!"); } @@ -168,7 +168,7 @@ var ReadAllNotificationsButton = (_ => { if (window.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) { this.stopping = true; - BDFDB.ModuleUtils.forceAllUpdates(this); + this.forceUpdateAll(); BDFDB.PluginUtils.clear(this); } @@ -177,6 +177,14 @@ var ReadAllNotificationsButton = (_ => { // Begin of own functions + onSettingsClosed () { + if (this.SettingsUpdated) { + delete this.SettingsUpdated; + + this.forceUpdateAll(); + } + } + onUserContextMenu (e) { if (e.instance.props.channel && e.type == "DMUserContextMenu") { let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: BDFDB.LibraryComponents.MenuItems.MenuGroup}); @@ -218,7 +226,7 @@ var ReadAllNotificationsButton = (_ => { style: {height: 20}, children: "read all", onClick: _ => { - let settings = BDFDB.DataUtils.get(this, "settings"), clear = _ => { + let clear = _ => { if (settings.includeGuilds) this.markGuildsAsRead(settings.includeMuted ? BDFDB.GuildUtils.getAll() : BDFDB.GuildUtils.getUnread()); if (settings.includeDMs) BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll()); }; @@ -284,7 +292,6 @@ var ReadAllNotificationsButton = (_ => { } processRecentsHeader (e) { - let settings = BDFDB.DataUtils.get(this, "settings"); if (settings.addClearButton && e.instance.props.tab == "Recent Mentions") e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement("div", { children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { text: `${BDFDB.LanguageUtils.LanguageStrings.CLOSE} (${BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL})`, @@ -338,6 +345,12 @@ var ReadAllNotificationsButton = (_ => { blacklist = savedBlacklist; BDFDB.DataUtils.save(savedBlacklist, this, "blacklist"); } + + forceUpdateAll () { + settings = BDFDB.DataUtils.get(this, "settings"); + + BDFDB.ModuleUtils.forceAllUpdates(this); + } setLabelsByLanguage () { switch (BDFDB.LanguageUtils.getLanguage().id) {