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

Commit

Permalink
Using ApplicationUser from PR event #124
Browse files Browse the repository at this point in the history
 * Was taking it from AuthenticationContext when a RESCOPED event occured. At that time the getCurrentUser() returns null.
  • Loading branch information
tomasbjerre committed Jun 23, 2016
1 parent 3e9d67a commit 1964ba4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 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 [#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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private void handleEvent(final PullRequestEvent pullRequestEvent) {
PrnfbPullRequestAction action = fromPullRequestEvent(pullRequestEvent, notification);
Map<PrnfbVariable, Supplier<String>> 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());
}
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/se/bjurr/prnfb/service/PrnfbRendererFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -29,7 +30,13 @@ public PrnfbRendererFactory(RepositoryService repositoryService, ApplicationProp

public PrnfbRenderer create(PullRequest pullRequest, PrnfbPullRequestAction pullRequestAction,
PrnfbNotification prnfbNotification, Map<PrnfbVariable, Supplier<String>> 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<PrnfbVariable, Supplier<String>> variables, ApplicationUser currentUser) {
return new PrnfbRenderer(pullRequest, pullRequestAction, currentUser, this.repositoryService, this.propertiesService,
prnfbNotification, variables, this.securityService);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>() {
Expand Down

0 comments on commit 1964ba4

Please sign in to comment.