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

Commit 86daca7

Browse files
committed
Adjustments after merge of #372
1 parent 7de2b9c commit 86daca7

File tree

5 files changed

+88
-77
lines changed

5 files changed

+88
-77
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@ As suggested: https://community.developer.atlassian.com/t/how-to-get-ajs-context
1919

2020
[e06f971ca6b2f05](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/e06f971ca6b2f05) Mads Opheim *2019-10-10 14:15:44*
2121

22+
### GitHub [#372](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/pull/372) Changes for bitbucket 7+
23+
Changes for bitbucket 7+ ()
24+
25+
Co-authored-by: sreer <RajeshKrishna.SreeramaKrishnan@in.pega.com>
26+
27+
[7de2b9c500cbe8a](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/7de2b9c500cbe8a) Rajesh Krishna *2020-12-05 17:41:51*
28+
2229
### No issue
30+
doc
31+
32+
[ec660104ede0b3c](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/ec660104ede0b3c) Tomas Bjerre *2020-04-26 05:54:39*
33+
2334
Correcting custom keystore
2435

2536
Using custom keystore even if "Accept Any Certificate" is disabled.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,4 @@ Changelog of Pull Request Notifier for Bitbucket.
337337
<quick.reload.version>2.0.0</quick.reload.version>
338338
<amps.version>8.0.2</amps.version>
339339
</properties>
340-
</project>
340+
</project>

src/main/resources/atlassian-plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
<dependency>com.atlassian.bitbucket.server.bitbucket-web-api:server</dependency>
9999
<context>bitbucket.ui.pullrequest.action</context>
100100
</web-resource>
101-
</atlassian-plugin>
101+
</atlassian-plugin>

src/main/resources/pr-triggerbutton.js

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require([
77
'bitbucket/util/server',
88
'@bitbucket/apps/pull-requests/initial-data'
99
], function(registry, $, AJS, _, thirdParty, srv, prData) {
10-
var prId = prData.pullRequest.id
11-
var repoId = prData.repository.id
10+
var prId = prData.pullRequest.id;
11+
var repoId = prData.repository.id;
1212
var buttonsAdminUrl = "/rest/prnfb-admin/1.0/settings/buttons";
1313

1414
var waiting = '<span class="aui-icon aui-icon-wait aui-icon-small">Wait</span>';
@@ -197,77 +197,77 @@ require([
197197
};
198198

199199
function submitButton(item, formResult) {
200-
srv.ajax({
201-
"type": "POST",
202-
"url": buttonsAdminUrl + '/' + item.uuid + '/press/repository/' + repoId +'/pullrequest/' + prId,
203-
"data": {
204-
"form": formResult
205-
},
206-
"success": function(content) {
207-
setTimeout(function() {
208-
if (content.confirmation == "on") {
209-
presentResult(content.notificationResponses);
210-
}
211-
}, 500);
212-
},
213-
"error": function(content) {
214-
AJS.flag({
215-
close: 'manual',
216-
type: 'error',
217-
title: "Unknown error",
218-
body: '<p>' + content.status + '</p>' + '<p>Check the Bitbucket Server log for more details.</p>'
219-
});
200+
srv.ajax({
201+
"type": "POST",
202+
"url": buttonsAdminUrl + '/' + item.uuid + '/press/repository/' + repoId + '/pullrequest/' + prId,
203+
"data": {
204+
"form": formResult
205+
},
206+
"success": function(content) {
207+
setTimeout(function() {
208+
if (content.confirmation == "on") {
209+
presentResult(content.notificationResponses);
220210
}
221-
});
222-
223-
if (item.redirectUrl) {
224-
window.location.replace(item.redirectUrl);
211+
}, 500);
212+
},
213+
"error": function(content) {
214+
AJS.flag({
215+
close: 'manual',
216+
type: 'error',
217+
title: "Unknown error",
218+
body: '<p>' + content.status + '</p>' + '<p>Check the Bitbucket Server log for more details.</p>'
219+
});
225220
}
221+
});
222+
223+
if (item.redirectUrl) {
224+
window.location.replace(item.redirectUrl);
225+
}
226226
}
227227

228228
function loadSettingsAndShowButtons() {
229229
srv.rest({
230-
url : buttonsAdminUrl + '/repository/' + repoId + '/pullrequest/' + prId,
231-
success : function(settings) {
232-
settings.forEach(function(item, index) {
233-
registry.registerExtension(
234-
'se.bjurr.prnfs.pull-request-notifier-for-stash:custom-buttons' + index,
235-
function buttonFactory(extensionAPI, context) {
236-
return {
237-
type: 'button',
238-
label: item.name,
239-
onAction : function() {
240-
if (item.confirmationText || item.buttonFormList && item.buttonFormList.length > 0) {
241-
// Create the form and dialog
242-
var confirmationText = confirmationTextTemplate(item.confirmationText);
243-
var form = formTemplate(item.buttonFormList);
244-
var formHtml = $("<div/>").append(confirmationText).append(form).html();
245-
var $dialog = $(dialogTemplate(item.name, formHtml));
246-
$dialog.appendTo($("body"));
230+
url: buttonsAdminUrl + '/repository/' + repoId + '/pullrequest/' + prId,
231+
success: function(settings) {
232+
settings.forEach(function(item, index) {
233+
registry.registerExtension(
234+
'se.bjurr.prnfs.pull-request-notifier-for-stash:custom-buttons' + index,
235+
function buttonFactory(extensionAPI, context) {
236+
return {
237+
type: 'button',
238+
label: item.name,
239+
onAction: function() {
240+
if (item.confirmationText || item.buttonFormList && item.buttonFormList.length > 0) {
241+
// Create the form and dialog
242+
var confirmationText = confirmationTextTemplate(item.confirmationText);
243+
var form = formTemplate(item.buttonFormList);
244+
var formHtml = $("<div/>").append(confirmationText).append(form).html();
245+
var $dialog = $(dialogTemplate(item.name, formHtml));
246+
$dialog.appendTo($("body"));
247247

248-
var dialogRef = AJS.dialog2($dialog);
248+
var dialogRef = AJS.dialog2($dialog);
249249

250-
// When you submit the form, we will post to the server with all the form data.
251-
AJS.$("#dialog-submit-button").click(function(e) {
252-
var formResult = $dialog.find("form").serializeJSON();
253-
e.preventDefault();
254-
dialogRef.hide();
255-
submitButton(item, formResult);
256-
});
257-
AJS.$("#dialog-close-button").click(function(e) {
258-
e.preventDefault();
259-
dialogRef.hide();
260-
});
261-
dialogRef.show();
262-
} else {
263-
submitButton(item, null);
264-
}
265-
}
266-
};
250+
// When you submit the form, we will post to the server with all the form data.
251+
AJS.$("#dialog-submit-button").click(function(e) {
252+
var formResult = $dialog.find("form").serializeJSON();
253+
e.preventDefault();
254+
dialogRef.hide();
255+
submitButton(item, formResult);
256+
});
257+
AJS.$("#dialog-close-button").click(function(e) {
258+
e.preventDefault();
259+
dialogRef.hide();
260+
});
261+
dialogRef.show();
262+
} else {
263+
submitButton(item, null);
267264
}
268-
);
269-
});
270-
}
265+
}
266+
};
267+
}
268+
);
269+
});
270+
}
271271
});
272272
}
273273

src/main/resources/utils.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ define('plugin/prnfb/utils', [
6161

6262
function getProjects(whenDone) {
6363
var projectsUrl = "/rest/api/1.0/projects?limit=999999";
64-
srv.rest ({
65-
url : projectsUrl,
66-
success: function(data) {
67-
whenDone(data);
68-
}
64+
srv.rest({
65+
url: projectsUrl,
66+
success: function(data) {
67+
whenDone(data);
68+
}
6969
});
7070
}
7171

@@ -95,12 +95,12 @@ define('plugin/prnfb/utils', [
9595
return;
9696
}
9797
var reposUrl = "/rest/api/1.0/projects/" + projectKey + "/repos?limit=999999";
98-
srv.rest ({
99-
url : reposUrl,
100-
success: function(data) {
101-
whenDone(data);
102-
}
103-
});
98+
srv.rest({
99+
url: reposUrl,
100+
success: function(data) {
101+
whenDone(data);
102+
}
103+
});
104104
}
105105

106106
function setupProjectAndRepoSettingsInForm($form, hasProjectAndRepo) {

0 commit comments

Comments
 (0)