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

Commit 6fc068a

Browse files
committed
Another attempt on fixing button issue #197
* This fix is not relying on the button being added by web-client-item configuration in atlassian-plugin.xml. The JS will now find the button-area without using the triggerManualNotification-class.
1 parent 2fdba48 commit 6fc068a

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
Changelog of Pull Request Notifier for Bitbucket.
44

5+
## Unreleased
6+
### GitHub [#197](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/197) Button not displaying on PRs which are merged
7+
Another attempt on fixing button issue
8+
9+
* This fix is not relying on the button being added by web-client-item configuration in atlassian-plugin.xml. The JS will now find the button-area without using the triggerManualNotification-class.
10+
11+
[92ee168c6078f78](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/92ee168c6078f78) Tomas Bjerre *2017-03-07 15:59:15*
12+
13+
### No issue
14+
doc
15+
16+
[2fdba488eb8d2f6](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/2fdba488eb8d2f6) Tomas Bjerre *2017-03-06 18:30:55*
17+
518
## 2.58
619
### GitHub [#197](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/197) Button not displaying on PRs which are merged
720
Workaround for BSERV-8896

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,4 +291,4 @@ Changelog of Pull Request Notifier for Bitbucket.
291291
<quick.reload.version>2.0.0</quick.reload.version>
292292
<amps.version>6.1.0</amps.version>
293293
</properties>
294-
</project>
294+
</project>

src/main/resources/atlassian-plugin.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@
5656
</web-item>
5757

5858
<client-web-item key="se.bjurr.prnfb.triggerbutton" name="Trigger Notification" weight="50" section="bitbucket.pullrequest.action">
59-
<label key="bitbucket.web.pull-request.toolbar.triggerbutton">Trigger Notification</label>
60-
<styleClass>triggerManualNotification</styleClass>
6159
<dependency>${project.groupId}-${project.artifactId}:pr-triggerbutton</dependency>
60+
<label key="bitbucket.web.pull-request.toolbar.triggerbutton"></label>
6261
</client-web-item>
6362

6463
<web-resource key="pr-triggerbutton">
@@ -68,9 +67,4 @@
6867
<dependency>com.atlassian.bitbucket.bitbucket-web-plugin:global</dependency>
6968
<context>bitbucket.page.pullRequest.view</context>
7069
</web-resource>
71-
72-
<web-resource key="fix-dependency-bug">
73-
<context>bitbucket.page.pullRequest.view</context>
74-
<dependency>com.atlassian.bitbucket.server.bitbucket-client-web-fragments:pull-request-header-more-location</dependency>
75-
</web-resource>
7670
</atlassian-plugin>

src/main/resources/pr-triggerbutton.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ define('plugin/prnfb/pr-triggerbutton', [
88
var buttonsAdminUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons";
99

1010
var waiting = '<span class="aui-icon aui-icon-wait aui-icon-small">Wait</span>';
11+
var $buttonArea = $('#pull-request-header-more').find('.aui-button').first().closest('ul');
12+
$buttonArea.find('.aui-button').each(function(index, auiButton) {
13+
if ($(auiButton).text().trim() === '') {
14+
//An empty button is added by 'client-web-item' in atlassian-plugin.xml
15+
auiButton.remove();
16+
}
17+
});
1118

12-
var $buttonArea = $(".triggerManualNotification").closest('ul');
1319
var buttonTemplate = function(name) {
1420
return $('<li><button class="aui-button aui-button-link prnfb-button" role="menuitem">' + name + '</button></li>');
1521
};
@@ -197,16 +203,6 @@ define('plugin/prnfb/pr-triggerbutton', [
197203
}
198204
};
199205

200-
if ($buttonArea.length === 0) {
201-
//Before 4.4.0
202-
$buttonArea = $(".triggerManualNotification").parent();
203-
buttonTemplate = function(name) {
204-
return $('<button class="aui-button">' + name + '</button>');
205-
};
206-
}
207-
208-
$(".triggerManualNotification").remove();
209-
210206
function loadSettingsAndShowButtons() {
211207
$.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) {
212208
$buttonArea.find('.prnfb-button').remove();

0 commit comments

Comments
 (0)