Skip to content

Commit a7b381f

Browse files
authored
Merge pull request #357 from atlassian-labs/dev
Forward merge to master
2 parents 2414ffa + be7d25e commit a7b381f

File tree

15 files changed

+42
-17
lines changed

15 files changed

+42
-17
lines changed

bitbucket-slack-server-integration-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.atlassian.bitbucket.plugins</groupId>
66
<artifactId>bitbucket-slack-server-integration-plugin</artifactId>
77
<packaging>atlassian-plugin</packaging>
8-
<version>4.0.9-SNAPSHOT</version>
8+
<version>4.0.10-SNAPSHOT</version>
99

1010
<name>Slack for Bitbucket Data Center</name>
1111
<description>This is the Slack integration for Bitbucket Data Center</description>

bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/NotificationUtil.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.atlassian.bitbucket.plugins.slack.notification;
22

3+
import static com.atlassian.bitbucket.plugins.slack.notification.PullRequestNotificationTypes.RESCOPED;
4+
35
import lombok.experimental.UtilityClass;
46

57
import java.util.Collections;
@@ -12,7 +14,9 @@
1214
public class NotificationUtil {
1315
public static Set<String> ALL_NOTIFICATION_TYPE_KEYS = Collections.unmodifiableSet(Stream
1416
.of(
15-
Stream.of(PullRequestNotificationTypes.values()).map(PullRequestNotificationTypes::getKey),
17+
Stream.of(PullRequestNotificationTypes.values())
18+
.filter(type -> RESCOPED != type)
19+
.map(PullRequestNotificationTypes::getKey),
1620
Stream.of(RepositoryNotificationTypes.values()).map(RepositoryNotificationTypes::getKey),
1721
Stream.of(TaskNotificationTypes.values()).map(TaskNotificationTypes::getKey)
1822
)

bitbucket-slack-server-integration-plugin/src/main/java/com/atlassian/bitbucket/plugins/slack/notification/PullRequestNotificationTypes.java

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.atlassian.bitbucket.event.pull.PullRequestParticipantReviewedEvent;
1414
import com.atlassian.bitbucket.event.pull.PullRequestParticipantUnapprovedEvent;
1515
import com.atlassian.bitbucket.event.pull.PullRequestReopenedEvent;
16+
import com.atlassian.bitbucket.event.pull.PullRequestRescopedEvent;
1617
import com.atlassian.bitbucket.event.pull.PullRequestReviewersUpdatedEvent;
1718
import com.atlassian.bitbucket.event.pull.PullRequestUpdatedEvent;
1819
import com.atlassian.sal.api.message.I18nResolver;
@@ -26,6 +27,7 @@
2627
public enum PullRequestNotificationTypes {
2728
OPENED("PRCreated"),
2829
UPDATED("PRParticipantUpdated"),
30+
RESCOPED("PRReScoped"),
2931
DECLINED("PRDeclined"),
3032
REOPENED("PRReopened"),
3133
MERGED("PRMerged"),
@@ -45,6 +47,7 @@ public enum PullRequestNotificationTypes {
4547
ImmutableMap.<Class<? extends PullRequestEvent>, PullRequestNotificationTypes>builder()
4648
.put(PullRequestOpenedEvent.class, PullRequestNotificationTypes.OPENED)
4749
.put(PullRequestUpdatedEvent.class, PullRequestNotificationTypes.UPDATED)
50+
.put(PullRequestRescopedEvent.class, PullRequestNotificationTypes.RESCOPED)
4851
.put(PullRequestDeclinedEvent.class, PullRequestNotificationTypes.DECLINED)
4952
.put(PullRequestReopenedEvent.class, PullRequestNotificationTypes.REOPENED)
5053
.put(PullRequestMergedEvent.class, PullRequestNotificationTypes.MERGED)

bitbucket-slack-server-integration-plugin/src/main/resources/com/atlassian/bitbucket/plugins/slack/bitbucket-slack.properties

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ slack.activity.pr.reviewed.short=:warning: {0} *reviewed* pull request {1} in {2
227227
slack.activity.pr.unapproved.needswork.short={0} *removed needs work review* from pull request {1} in {2}
228228
slack.activity.pr.merged.short=:tada: {0} *merged* pull request {1} in {2}
229229
slack.activity.pr.updated.short={0} *updated* pull request {1} in {2}
230+
slack.activity.pr.rescoped.short={0} *re-scoped* pull request {1} in {2}
230231
slack.activity.pr.comment.added.short=:speech_balloon: {0} *commented* on pull request {1} in {2}
231232
slack.activity.pr.comment.deleted.short=:speech_balloon: {0} *deleted a comment* on pull request {1} in {2}
232233
slack.activity.pr.comment.edited.short=:speech_balloon: {0} *edited a comment* on pull request {1} in {2}
@@ -249,6 +250,7 @@ slack.activity.pr.reviewed.long=:warning: {0} *reviewed* pull request {1} {3} \u
249250
slack.activity.pr.unapproved.needswork.long={0} *removed needs work review* from pull request {1} {3} \u2192 {4} in {2}
250251
slack.activity.pr.merged.long=:tada: {0} *merged* pull request {1} {3} \u2192 {4} in {2}
251252
slack.activity.pr.updated.long={0} *updated* pull request {1} {3} \u2192 {4} in {2}
253+
slack.activity.pr.rescoped.long={0} *re-scoped* pull request {1} {3} \u2192 {4} in {2}
252254
slack.activity.pr.comment.added.long=:speech_balloon: {0} *commented* on pull request {1} {3} \u2192 {4} in {2}
253255
slack.activity.pr.comment.deleted.long=:speech_balloon: {0} *deleted a comment* on pull request {1} {3} \u2192 {4} in {2}
254256
slack.activity.pr.comment.edited.long=:speech_balloon: {0} *edited a comment* on pull request {1} {3} \u2192 {4} in {2}

bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/listener/BitbucketNotificationEventListenerTest.java

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.atlassian.bitbucket.event.pull.PullRequestParticipantReviewedEvent;
3030
import com.atlassian.bitbucket.event.pull.PullRequestParticipantUnapprovedEvent;
3131
import com.atlassian.bitbucket.event.pull.PullRequestReopenedEvent;
32+
import com.atlassian.bitbucket.event.pull.PullRequestRescopedEvent;
3233
import com.atlassian.bitbucket.event.pull.PullRequestReviewersUpdatedEvent;
3334
import com.atlassian.bitbucket.event.pull.PullRequestUpdatedEvent;
3435
import com.atlassian.bitbucket.event.repository.RepositoryForkedEvent;
@@ -90,6 +91,8 @@ class BitbucketNotificationEventListenerTest {
9091
@Mock
9192
private PullRequestUpdatedEvent pullRequestUpdatedEvent;
9293
@Mock
94+
private PullRequestRescopedEvent pullRequestRescopedEvent;
95+
@Mock
9396
private PullRequestDeclinedEvent pullRequestDeclinedEvent;
9497
@Mock
9598
private PullRequestReopenedEvent pullRequestReopenedEvent;
@@ -267,6 +270,11 @@ void onEvent_pullRequestUpdatedEvent_shouldCallExpectedMethods() {
267270
testPullRequestEvent(pullRequestUpdatedEvent, PullRequestNotificationTypes.UPDATED);
268271
}
269272

273+
@Test
274+
void onEvent_pullRequestRescopedEvent_shouldCallExpectedMethods() {
275+
testPullRequestEvent(pullRequestRescopedEvent, PullRequestNotificationTypes.RESCOPED);
276+
}
277+
270278
@Test
271279
void onEvent_pullRequestDeclinedEvent_shouldCallExpectedMethods() {
272280
testPullRequestEvent(pullRequestDeclinedEvent, PullRequestNotificationTypes.DECLINED);

bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/configuration/DefaultNotificationConfigurationServiceTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import static org.mockito.Mockito.doThrow;
2323
import static org.mockito.Mockito.times;
2424
import static org.mockito.Mockito.verify;
25-
import static org.mockito.Mockito.when;
2625

2726
@ExtendWith(MockitoExtension.class)
2827
public class DefaultNotificationConfigurationServiceTest {

bitbucket-slack-server-integration-plugin/src/test/java/com/atlassian/bitbucket/plugins/slack/notification/renderer/SlackNotificationRendererTest.java

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.atlassian.bitbucket.event.pull.PullRequestParticipantReviewedEvent;
1818
import com.atlassian.bitbucket.event.pull.PullRequestParticipantUnapprovedEvent;
1919
import com.atlassian.bitbucket.event.pull.PullRequestReopenedEvent;
20+
import com.atlassian.bitbucket.event.pull.PullRequestRescopedEvent;
2021
import com.atlassian.bitbucket.event.pull.PullRequestReviewersUpdatedEvent;
2122
import com.atlassian.bitbucket.event.pull.PullRequestUpdatedEvent;
2223
import com.atlassian.bitbucket.event.repository.RepositoryForkedEvent;
@@ -142,6 +143,8 @@ public class SlackNotificationRendererTest {
142143
@Mock
143144
PullRequestUpdatedEvent pullRequestUpdatedEvent;
144145
@Mock
146+
PullRequestRescopedEvent pullRequestRescopedEvent;
147+
@Mock
145148
PullRequestCommentEvent pullRequestCommentEvent;
146149
@Mock
147150
PullRequestReviewersUpdatedEvent pullRequestReviewersUpdatedEvent;
@@ -479,6 +482,16 @@ void getPullRequestOpenedMessage_shouldBuildCorrectSlackMessage() {
479482
testGenericPullRequestMessage(pullRequestOpenedEvent, PullRequestAction.OPENED);
480483
}
481484

485+
@Test
486+
void getPullRequestUpdatedMessage_shouldBuildCorrectSlackMessage() {
487+
testGenericPullRequestMessage(pullRequestUpdatedEvent, PullRequestAction.UPDATED);
488+
}
489+
490+
@Test
491+
void getPullRequestRescopedMessage_shouldBuildCorrectSlackMessage() {
492+
testGenericPullRequestMessage(pullRequestRescopedEvent, PullRequestAction.RESCOPED);
493+
}
494+
482495
@Test
483496
void getPullRequestApprovedMessage_shouldBuildCorrectSlackMessage() {
484497
testGenericPullRequestMessage(pullRequestApprovedEvent, PullRequestAction.APPROVED);

confluence-slack-integration/confluence-slack-server-integration-plugin/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<artifactId>confluence-slack-server-integration-plugin</artifactId>
1212
<packaging>atlassian-plugin</packaging>
1313
<name>Slack for Confluence Data Center</name>
14-
<version>3.0.5-SNAPSHOT</version>
14+
<version>3.0.6-SNAPSHOT</version>
1515
<description>This is the Slack integration for Confluence Data Center</description>
1616

1717
<properties>

confluence-slack-integration/confluence-slack-server-integration-plugin/src/main/resources/js/confluence-slack-status.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ require([
6161
event.stopPropagation();
6262
}
6363

64-
$(function () {
65-
$('body').bind('ajaxComplete', handleAjaxComplete);
64+
$(function() {
65+
$(document).on('ajaxComplete', handleAjaxComplete);
6666
});
6767
});

jira-slack-server-integration/jira-slack-server-integration-plugin/src/main/resources/js/jira-slack-status.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ require([
4949
}
5050

5151
$(function() {
52-
$('body').bind('ajaxComplete', handleAjaxComplete);
52+
$(document).on('ajaxComplete', handleAjaxComplete);
5353
});
5454
});

jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/it/com/atlassian/jira/plugins/slack/functional/SanityCheckFuncTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
import org.junit.Before;
77
import org.junit.Test;
88

9-
import static com.atlassian.jira.testkit.client.util.TimeBombLicence.LICENCE_FOR_TESTING;
109
import static com.atlassian.plugins.slack.test.RequestMatchers.success;
1110
import static it.com.atlassian.jira.plugins.slack.util.JiraFuncTestData.SAMPLE_DATA;
1211
import static org.hamcrest.MatcherAssert.assertThat;
1312
import static org.hamcrest.Matchers.containsString;
1413

1514
@SkipCacheCheck
1615
public class SanityCheckFuncTest extends SlackFunctionalTestBase {
16+
1717
@Before
1818
public void beforeEach() {
19-
backdoor.restoreDataFromResource(SAMPLE_DATA, LICENCE_FOR_TESTING);
19+
backdoor.restoreDataFromResource(SAMPLE_DATA);
2020
}
2121

2222
@Test

jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/it/com/atlassian/jira/plugins/slack/functional/UnfurlingFuncTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import java.util.List;
1212

13-
import static com.atlassian.jira.testkit.client.util.TimeBombLicence.LICENCE_FOR_TESTING;
1413
import static com.atlassian.plugins.slack.test.RequestMatchers.hasHit;
1514
import static com.atlassian.plugins.slack.test.RequestMatchers.requestEntityProperty;
1615
import static com.github.seratch.jslack.api.methods.Methods.CHAT_UNFURL;
@@ -23,7 +22,7 @@
2322
public class UnfurlingFuncTest extends SlackFunctionalTestBase {
2423
@Before
2524
public void beforeEach() {
26-
backdoor.restoreDataFromResource(SAMPLE_DATA, LICENCE_FOR_TESTING);
25+
backdoor.restoreDataFromResource(SAMPLE_DATA);
2726
}
2827

2928
@Test

jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/it/com/atlassian/jira/plugins/slack/functional/UserLinkFuncTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.junit.Before;
77
import org.junit.Test;
88

9-
import static com.atlassian.jira.testkit.client.util.TimeBombLicence.LICENCE_FOR_TESTING;
109
import static com.atlassian.plugins.slack.test.TestTeams.DUMMY_TEAM_ID;
1110
import static it.com.atlassian.jira.plugins.slack.util.JiraFuncTestData.SAMPLE_DATA;
1211
import static org.hamcrest.MatcherAssert.assertThat;
@@ -16,7 +15,7 @@
1615
public class UserLinkFuncTest extends SlackFunctionalTestBase {
1716
@Before
1817
public void beforeEach() {
19-
backdoor.restoreDataFromResource(SAMPLE_DATA, LICENCE_FOR_TESTING);
18+
backdoor.restoreDataFromResource(SAMPLE_DATA);
2019
}
2120

2221
@Test

jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/it/com/atlassian/jira/plugins/slack/functional/WorkspaceLinkFuncTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.junit.Before;
77
import org.junit.Test;
88

9-
import static com.atlassian.jira.testkit.client.util.TimeBombLicence.LICENCE_FOR_TESTING;
109
import static com.atlassian.plugins.slack.test.RequestMatchers.body;
1110
import static com.atlassian.plugins.slack.test.RequestMatchers.hasHit;
1211
import static com.atlassian.plugins.slack.test.RequestMatchers.request;
@@ -24,7 +23,7 @@
2423
public class WorkspaceLinkFuncTest extends SlackFunctionalTestBase {
2524
@Before
2625
public void beforeEach() {
27-
backdoor.restoreDataFromResource(SAMPLE_DATA, LICENCE_FOR_TESTING);
26+
backdoor.restoreDataFromResource(SAMPLE_DATA);
2827
}
2928

3029
@Test

jira-slack-server-integration/jira-slack-server-integration-plugin/src/test/java/it/com/atlassian/jira/plugins/slack/web/ConfigurationWebTest.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.List;
2020
import java.util.Optional;
2121

22-
import static com.atlassian.jira.testkit.client.util.TimeBombLicence.LICENCE_FOR_TESTING;
2322
import static com.atlassian.plugins.slack.test.RequestMatchers.hasHit;
2423
import static com.atlassian.plugins.slack.test.RequestMatchers.requestEntityProperty;
2524
import static com.atlassian.plugins.slack.test.TestChannels.PUBLIC;
@@ -44,7 +43,7 @@ public class ConfigurationWebTest extends SlackWebTestBase {
4443

4544
@Before
4645
public void beforeEach() {
47-
backdoor.restoreDataFromResource(SAMPLE_DATA, LICENCE_FOR_TESTING);
46+
backdoor.restoreDataFromResource(SAMPLE_DATA);
4847
flakyWebTestKiller.disableJiraFlags();
4948
connectToDummyTeamAndConfirmAdminAccount();
5049
}

0 commit comments

Comments
 (0)