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

Commit

Permalink
Another attempt on fixing button issue #197
Browse files Browse the repository at this point in the history
 * 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.
  • Loading branch information
tomasbjerre committed Mar 7, 2017
1 parent 2fdba48 commit 6fc068a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

Changelog of Pull Request Notifier for Bitbucket.

## Unreleased
### GitHub [#197](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/197) Button not displaying on PRs which are merged
Another attempt on fixing button issue

* 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.

[92ee168c6078f78](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/92ee168c6078f78) Tomas Bjerre *2017-03-07 15:59:15*

### No issue
doc

[2fdba488eb8d2f6](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/2fdba488eb8d2f6) Tomas Bjerre *2017-03-06 18:30:55*

## 2.58
### GitHub [#197](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/197) Button not displaying on PRs which are merged
Workaround for BSERV-8896
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ Changelog of Pull Request Notifier for Bitbucket.
<quick.reload.version>2.0.0</quick.reload.version>
<amps.version>6.1.0</amps.version>
</properties>
</project>
</project>
8 changes: 1 addition & 7 deletions src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
</web-item>

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

<web-resource key="pr-triggerbutton">
Expand All @@ -68,9 +67,4 @@
<dependency>com.atlassian.bitbucket.bitbucket-web-plugin:global</dependency>
<context>bitbucket.page.pullRequest.view</context>
</web-resource>

<web-resource key="fix-dependency-bug">
<context>bitbucket.page.pullRequest.view</context>
<dependency>com.atlassian.bitbucket.server.bitbucket-client-web-fragments:pull-request-header-more-location</dependency>
</web-resource>
</atlassian-plugin>
18 changes: 7 additions & 11 deletions src/main/resources/pr-triggerbutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ define('plugin/prnfb/pr-triggerbutton', [
var buttonsAdminUrl = AJS.contextPath() + "/rest/prnfb-admin/1.0/settings/buttons";

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

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

if ($buttonArea.length === 0) {
//Before 4.4.0
$buttonArea = $(".triggerManualNotification").parent();
buttonTemplate = function(name) {
return $('<button class="aui-button">' + name + '</button>');
};
}

$(".triggerManualNotification").remove();

function loadSettingsAndShowButtons() {
$.get(buttonsAdminUrl + '/repository/' + pageState.getRepository().id + '/pullrequest/' + pageState.getPullRequest().id, function(settings) {
$buttonArea.find('.prnfb-button').remove();
Expand Down

0 comments on commit 6fc068a

Please sign in to comment.