diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 7a4bc0535d2..11f4fe4cba1 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -16,6 +16,10 @@ import { userPath } from 'discourse/lib/url'; const customPostMessageCallbacks = {}; +export function resetCustomPostMessageCallbacks() { + customPostMessageCallbacks = {}; +} + export function registerCustomPostMessageCallback(type, callback) { if (customPostMessageCallbacks[type]) { throw `Error ${type} is an already registered post message!`; diff --git a/test/javascripts/helpers/qunit-helpers.js.es6 b/test/javascripts/helpers/qunit-helpers.js.es6 index 1a267c8c435..50bf08bef0d 100644 --- a/test/javascripts/helpers/qunit-helpers.js.es6 +++ b/test/javascripts/helpers/qunit-helpers.js.es6 @@ -10,6 +10,7 @@ import { flushMap } from 'discourse/models/store'; import { clearRewrites } from 'discourse/lib/url'; import { initSearchData } from 'discourse/widgets/search-menu'; import { resetDecorators } from 'discourse/widgets/widget'; +import { resetCustomPostMessageCallbacks } from 'discourse/controllers/topic'; export function currentUser() { return Discourse.User.create(sessionFixtures['/session/current.json'].current_user); @@ -107,6 +108,7 @@ export function acceptance(name, options) { clearRewrites(); initSearchData(); resetDecorators(); + resetCustomPostMessageCallbacks(); Discourse.reset(); } });