diff --git a/CHANGELOG.md b/CHANGELOG.md index e7ca0ef..298f648 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ Changelog of Pull Request Notifier for Bitbucket. +## Unreleased +### GitHub [#124](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/124) PR Updated not triggering a Job + Using ApplicationUser from PR event + + * Was taking it from AuthenticationContext when a RESCOPED event occured. At that time the getCurrentUser() returns null. + + [b70b9d0e3b4091f](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/b70b9d0e3b4091f) Tomas Bjerre *2016-06-23 14:44:29* + +### No issue + Building with BBS 4.7.1 + + [3e9d67a80f506cc](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/3e9d67a80f506cc) Tomas Bjerre *2016-06-22 19:29:28* + ## 2.25 ### GitHub [#123](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/123) Question on the configuration permissions. Only showing repo settings on repo admin page diff --git a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java index 6cd471d..3ae5688 100644 --- a/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java +++ b/src/main/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListener.java @@ -235,7 +235,7 @@ private void handleEvent(final PullRequestEvent pullRequestEvent) { PrnfbPullRequestAction action = fromPullRequestEvent(pullRequestEvent, notification); Map> variables = populateVariables(pullRequestEvent); PrnfbRenderer renderer = this.prnfbRendererFactory.create(pullRequestEvent.getPullRequest(), action, notification, - variables); + variables, pullRequestEvent.getUser()); notify(notification, action, pullRequestEvent.getPullRequest(), renderer, clientKeyStore, settings.isShouldAcceptAnyCertificate()); } diff --git a/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java b/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java index afa8463..331e796 100644 --- a/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java +++ b/src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java @@ -9,6 +9,7 @@ import com.atlassian.bitbucket.pull.PullRequest; import com.atlassian.bitbucket.repository.RepositoryService; import com.atlassian.bitbucket.server.ApplicationPropertiesService; +import com.atlassian.bitbucket.user.ApplicationUser; import com.atlassian.bitbucket.user.SecurityService; import com.google.common.base.Supplier; @@ -29,7 +30,13 @@ public PrnfbRendererFactory(RepositoryService repositoryService, ApplicationProp public PrnfbRenderer create(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction, PrnfbNotification prnfbNotification, Map> variables) { - return new PrnfbRenderer(pullRequest, pullRequestAction, this.authenticationContext.getCurrentUser(), - this.repositoryService, this.propertiesService, prnfbNotification, variables, this.securityService); + return create(pullRequest, pullRequestAction, prnfbNotification, variables, + this.authenticationContext.getCurrentUser()); + } + + public PrnfbRenderer create(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction, + PrnfbNotification prnfbNotification, Map> variables, ApplicationUser currentUser) { + return new PrnfbRenderer(pullRequest, pullRequestAction, currentUser, this.repositoryService, this.propertiesService, + prnfbNotification, variables, this.securityService); } } diff --git a/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java b/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java index 186f144..ccf9088 100644 --- a/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java +++ b/src/test/java/se/bjurr/prnfb/listener/PrnfbPullRequestEventListenerTest.java @@ -130,7 +130,7 @@ public void invoke(UrlInvoker urlInvoker) { when(this.settingsService.getNotifications())// .thenReturn(notifications); - when(this.prnfbRendererFactory.create(any(), any(), any(), any()))// + when(this.prnfbRendererFactory.create(any(), any(), any(), any(), any()))// .thenReturn(this.renderer); when(this.renderer.render(any(), any(), any(), any()))// .thenAnswer(new Answer() {