Skip to content

A platform for community discussion. Free, open, simple.

DEV: Clear extra header buttons (#17829)

Jarek Radosz9645cbea26a6
diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index 0c445bbe37c..bbb665c6083 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -14,12 +14,16 @@ import { logSearchLinkClick } from "discourse/lib/search";
import RenderGlimmer from "discourse/widgets/render-glimmer";
import { hbs } from "ember-cli-htmlbars";
-const _extraHeaderIcons = [];
+let _extraHeaderIcons = [];
export function addToHeaderIcons(icon) {
_extraHeaderIcons.push(icon);
}
+export function clearExtraHeaderIcons() {
+ _extraHeaderIcons = [];
+}
+
const dropdown = {
buildClasses(attrs) {
let classes = attrs.classNames || [];
diff --git a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
index 965f16710ba..205e7f61925 100644
--- a/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
+++ b/app/assets/javascripts/discourse/tests/helpers/qunit-helpers.js
@@ -71,6 +71,7 @@ import {
} from "discourse/lib/to-markdown";
import { clearTagsHtmlCallbacks } from "discourse/lib/render-tags";
import { clearToolbarCallbacks } from "discourse/components/d-editor";
+import { clearExtraHeaderIcons } from "discourse/widgets/header";
import { resetSidebarSection } from "discourse/lib/sidebar/custom-sections";
import { resetNotificationTypeRenderers } from "discourse/lib/notification-item";
@@ -202,6 +203,7 @@ export function testCleanup(container, app) {
clearToolbarCallbacks();
resetSidebarSection();
resetNotificationTypeRenderers();
+ clearExtraHeaderIcons();
}
export function discourseModule(name, options) {