From 4b0ffaa64d453edd02c51b85cc632db3a225babb Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 5 Aug 2015 19:20:28 +0930 Subject: [PATCH] Prevent newly-created discussions from triggering alert in own browser --- extensions/pusher/js/forum/src/main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/extensions/pusher/js/forum/src/main.js b/extensions/pusher/js/forum/src/main.js index caace239d..0ac8a5d6e 100644 --- a/extensions/pusher/js/forum/src/main.js +++ b/extensions/pusher/js/forum/src/main.js @@ -84,6 +84,24 @@ app.initializers.add('pusher', () => { } }); + // Prevent any newly-created discussions from triggering the discussion list + // update button showing. + // TODO: Might be better pause the response to the push updates while the + // composer is loading? idk + extend(DiscussionList.prototype, 'addDiscussion', function(returned, discussion) { + const index = app.pushedUpdates.indexOf(discussion.id()); + + if (index !== -1) { + app.pushedUpdates.splice(index, 1); + } + + if (app.current instanceof IndexPage) { + app.setTitleCount(app.pushedUpdates.length); + } + + m.redraw(); + }); + extend(DiscussionPage.prototype, 'config', function(x, isInitialized, context) { if (isInitialized) return;