From 51b86d712403f3c66a62bdc96579b7c2dcf3d5b9 Mon Sep 17 00:00:00 2001 From: Tomas Bjerre Date: Sat, 4 Mar 2017 16:51:12 +0100 Subject: [PATCH] Avoid adding same button multiple times #206 --- src/main/resources/pr-triggerbutton.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/pr-triggerbutton.js b/src/main/resources/pr-triggerbutton.js index adaf3b83..854d151a 100644 --- a/src/main/resources/pr-triggerbutton.js +++ b/src/main/resources/pr-triggerbutton.js @@ -11,7 +11,7 @@ define('plugin/prnfb/pr-triggerbutton', [ var $buttonArea = $(".triggerManualNotification").closest('ul'); var buttonTemplate = function(name) { - return $('
  • '); + return $('
  • '); }; var dialogTemplate = function(name, content) { @@ -209,6 +209,7 @@ define('plugin/prnfb/pr-triggerbutton', [ function loadSettingsAndShowButtons() { $.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) { + $buttonArea.find('.prnfb-button').remove(); settings.forEach(function(item) { var $buttonDropdownItem = buttonTemplate(item.name.replace(/