From 86daca7399fb136eeb61a09a3b6c187ff108aebf Mon Sep 17 00:00:00 2001 From: Tomas Bjerre Date: Sat, 5 Dec 2020 18:45:43 +0100 Subject: [PATCH] Adjustments after merge of #372 --- CHANGELOG.md | 11 ++ pom.xml | 2 +- src/main/resources/atlassian-plugin.xml | 2 +- src/main/resources/pr-triggerbutton.js | 128 ++++++++++++------------ src/main/resources/utils.js | 22 ++-- 5 files changed, 88 insertions(+), 77 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60a3237..2f7b710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,18 @@ As suggested: https://community.developer.atlassian.com/t/how-to-get-ajs-context [e06f971ca6b2f05](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/e06f971ca6b2f05) Mads Opheim *2019-10-10 14:15:44* +### GitHub [#372](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/pull/372) Changes for bitbucket 7+ + Changes for bitbucket 7+ () + +Co-authored-by: sreer + + [7de2b9c500cbe8a](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/7de2b9c500cbe8a) Rajesh Krishna *2020-12-05 17:41:51* + ### No issue + doc + + [ec660104ede0b3c](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/ec660104ede0b3c) Tomas Bjerre *2020-04-26 05:54:39* + Correcting custom keystore Using custom keystore even if "Accept Any Certificate" is disabled. diff --git a/pom.xml b/pom.xml index 495c890..61c77f2 100644 --- a/pom.xml +++ b/pom.xml @@ -337,4 +337,4 @@ Changelog of Pull Request Notifier for Bitbucket. 2.0.0 8.0.2 - + \ No newline at end of file diff --git a/src/main/resources/atlassian-plugin.xml b/src/main/resources/atlassian-plugin.xml index 8ebc25a..b61024e 100644 --- a/src/main/resources/atlassian-plugin.xml +++ b/src/main/resources/atlassian-plugin.xml @@ -98,4 +98,4 @@ com.atlassian.bitbucket.server.bitbucket-web-api:server bitbucket.ui.pullrequest.action - + \ No newline at end of file diff --git a/src/main/resources/pr-triggerbutton.js b/src/main/resources/pr-triggerbutton.js index 3285322..dcc147c 100644 --- a/src/main/resources/pr-triggerbutton.js +++ b/src/main/resources/pr-triggerbutton.js @@ -7,8 +7,8 @@ require([ 'bitbucket/util/server', '@bitbucket/apps/pull-requests/initial-data' ], function(registry, $, AJS, _, thirdParty, srv, prData) { - var prId = prData.pullRequest.id - var repoId = prData.repository.id + var prId = prData.pullRequest.id; + var repoId = prData.repository.id; var buttonsAdminUrl = "/rest/prnfb-admin/1.0/settings/buttons"; var waiting = 'Wait'; @@ -197,77 +197,77 @@ require([ }; function submitButton(item, formResult) { - srv.ajax({ - "type": "POST", - "url": buttonsAdminUrl + '/' + item.uuid + '/press/repository/' + repoId +'/pullrequest/' + prId, - "data": { - "form": formResult - }, - "success": function(content) { - setTimeout(function() { - if (content.confirmation == "on") { - presentResult(content.notificationResponses); - } - }, 500); - }, - "error": function(content) { - AJS.flag({ - close: 'manual', - type: 'error', - title: "Unknown error", - body: '

' + content.status + '

' + '

Check the Bitbucket Server log for more details.

' - }); + srv.ajax({ + "type": "POST", + "url": buttonsAdminUrl + '/' + item.uuid + '/press/repository/' + repoId + '/pullrequest/' + prId, + "data": { + "form": formResult + }, + "success": function(content) { + setTimeout(function() { + if (content.confirmation == "on") { + presentResult(content.notificationResponses); } - }); - - if (item.redirectUrl) { - window.location.replace(item.redirectUrl); + }, 500); + }, + "error": function(content) { + AJS.flag({ + close: 'manual', + type: 'error', + title: "Unknown error", + body: '

' + content.status + '

' + '

Check the Bitbucket Server log for more details.

' + }); } + }); + + if (item.redirectUrl) { + window.location.replace(item.redirectUrl); + } } function loadSettingsAndShowButtons() { srv.rest({ - url : buttonsAdminUrl + '/repository/' + repoId + '/pullrequest/' + prId, - success : function(settings) { - settings.forEach(function(item, index) { - registry.registerExtension( - 'se.bjurr.prnfs.pull-request-notifier-for-stash:custom-buttons' + index, - function buttonFactory(extensionAPI, context) { - return { - type: 'button', - label: item.name, - onAction : function() { - if (item.confirmationText || item.buttonFormList && item.buttonFormList.length > 0) { - // Create the form and dialog - var confirmationText = confirmationTextTemplate(item.confirmationText); - var form = formTemplate(item.buttonFormList); - var formHtml = $("
").append(confirmationText).append(form).html(); - var $dialog = $(dialogTemplate(item.name, formHtml)); - $dialog.appendTo($("body")); + url: buttonsAdminUrl + '/repository/' + repoId + '/pullrequest/' + prId, + success: function(settings) { + settings.forEach(function(item, index) { + registry.registerExtension( + 'se.bjurr.prnfs.pull-request-notifier-for-stash:custom-buttons' + index, + function buttonFactory(extensionAPI, context) { + return { + type: 'button', + label: item.name, + onAction: function() { + if (item.confirmationText || item.buttonFormList && item.buttonFormList.length > 0) { + // Create the form and dialog + var confirmationText = confirmationTextTemplate(item.confirmationText); + var form = formTemplate(item.buttonFormList); + var formHtml = $("
").append(confirmationText).append(form).html(); + var $dialog = $(dialogTemplate(item.name, formHtml)); + $dialog.appendTo($("body")); - var dialogRef = AJS.dialog2($dialog); + var dialogRef = AJS.dialog2($dialog); - // When you submit the form, we will post to the server with all the form data. - AJS.$("#dialog-submit-button").click(function(e) { - var formResult = $dialog.find("form").serializeJSON(); - e.preventDefault(); - dialogRef.hide(); - submitButton(item, formResult); - }); - AJS.$("#dialog-close-button").click(function(e) { - e.preventDefault(); - dialogRef.hide(); - }); - dialogRef.show(); - } else { - submitButton(item, null); - } - } - }; + // When you submit the form, we will post to the server with all the form data. + AJS.$("#dialog-submit-button").click(function(e) { + var formResult = $dialog.find("form").serializeJSON(); + e.preventDefault(); + dialogRef.hide(); + submitButton(item, formResult); + }); + AJS.$("#dialog-close-button").click(function(e) { + e.preventDefault(); + dialogRef.hide(); + }); + dialogRef.show(); + } else { + submitButton(item, null); } - ); - }); - } + } + }; + } + ); + }); + } }); } diff --git a/src/main/resources/utils.js b/src/main/resources/utils.js index b2121ed..6b31eb6 100644 --- a/src/main/resources/utils.js +++ b/src/main/resources/utils.js @@ -61,11 +61,11 @@ define('plugin/prnfb/utils', [ function getProjects(whenDone) { var projectsUrl = "/rest/api/1.0/projects?limit=999999"; - srv.rest ({ - url : projectsUrl, - success: function(data) { - whenDone(data); - } + srv.rest({ + url: projectsUrl, + success: function(data) { + whenDone(data); + } }); } @@ -95,12 +95,12 @@ define('plugin/prnfb/utils', [ return; } var reposUrl = "/rest/api/1.0/projects/" + projectKey + "/repos?limit=999999"; - srv.rest ({ - url : reposUrl, - success: function(data) { - whenDone(data); - } - }); + srv.rest({ + url: reposUrl, + success: function(data) { + whenDone(data); + } + }); } function setupProjectAndRepoSettingsInForm($form, hasProjectAndRepo) {