From f976d9f5f60253f60ed456e076761994cb31841f Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@googlemail.com> Date: Thu, 16 Oct 2014 03:08:00 +0200 Subject: [PATCH] refs #6452 remove existing notification before creating new one --- plugins/CoreHome/javascripts/notification.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plugins/CoreHome/javascripts/notification.js b/plugins/CoreHome/javascripts/notification.js index 266477446e..4d8ff0c8f7 100644 --- a/plugins/CoreHome/javascripts/notification.js +++ b/plugins/CoreHome/javascripts/notification.js @@ -50,6 +50,8 @@ options = {}; } + closeExistingNotificationHavingSameIdIfNeeded(options); + var template = generateNotificationHtmlMarkup(options, message); this.$node = placeNotification(template, options); }; @@ -108,4 +110,17 @@ return $notificationNode; } + + function closeExistingNotificationHavingSameIdIfNeeded(options) + { + if (!options.id) { + return; + } + + var $existingNode = $('[notification-id=' + options.id + ']'); + if ($existingNode && $existingNode.length) { + $existingNode.remove(); + } + } + })(jQuery, require); \ No newline at end of file -- GitLab