Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit 51b86d7

Browse files
committed
Avoid adding same button multiple times #206
1 parent 87db223 commit 51b86d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/resources/pr-triggerbutton.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ define('plugin/prnfb/pr-triggerbutton', [
1111

1212
var $buttonArea = $(".triggerManualNotification").closest('ul');
1313
var buttonTemplate = function(name) {
14-
return $('<li><button class="aui-button aui-button-link" role="menuitem">' + name + '</button></li>');
14+
return $('<li><button class="aui-button aui-button-link prnfb-button" role="menuitem">' + name + '</button></li>');
1515
};
1616

1717
var dialogTemplate = function(name, content) {
@@ -209,6 +209,7 @@ define('plugin/prnfb/pr-triggerbutton', [
209209

210210
function loadSettingsAndShowButtons() {
211211
$.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) {
212+
$buttonArea.find('.prnfb-button').remove();
212213
settings.forEach(function(item) {
213214
var $buttonDropdownItem = buttonTemplate(item.name.replace(/<script>/g, 'script'));
214215
$buttonDropdownItem.click(function() {

0 commit comments

Comments
 (0)