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

Commit

Permalink
Fixing PULL_REQUEST_URL-bug correctly with getSlug #82
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Nov 9, 2015
1 parent 0cd2c14 commit c19f72f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Changelog of Pull Request Notifier for Bitbucket.

## 2.12
* Fixing PULL_REQUEST_URL-bug correctly with getSlug.

## 2.11
* Bugfix: Replacing spaces with dashes in ${PULL_REQUEST_URL}. Was evaluating to wrong URL if repo name included spaces.

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/se/bjurr/prnfb/listener/PrnfbRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,8 @@ private static String cloneUrlFromRepository(REPO_PROTOCOL protocol, Repository
}

private static String getPullRequestUrl(ApplicationPropertiesService propertiesService, PullRequest pullRequest) {
return (propertiesService.getBaseUrl() + "/projects/" + pullRequest.getToRef().getRepository().getProject().getKey()
+ "/repos/" + pullRequest.getToRef().getRepository().getName() + "/pull-requests/" + pullRequest.getId())
.replaceAll(" ", "-");
return propertiesService.getBaseUrl() + "/projects/" + pullRequest.getToRef().getRepository().getProject().getKey()
+ "/repos/" + pullRequest.getToRef().getRepository().getSlug() + "/pull-requests/" + pullRequest.getId();
}

PrnfbVariable(Resolver resolver) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void testThatAUrlWithVariablesExceptFromAndToCanBeInvoked() throws Except
pullRequestRefBuilder() //
.withProjectKey("theProject") //
.withRepositoryName("the Repo Name") //
) //
.withRepositorySlug("the-repo-name")) //
.withPullRequestAction(OPENED) //
.withAuthor( //
prnfbParticipantBuilder() //
Expand All @@ -426,7 +426,7 @@ public void testThatAUrlWithVariablesExceptFromAndToCanBeInvoked() throws Except
) //
.invokedUrl(
0,
"http://bjurr.se/id=10&action=OPENED&displayName=authorDisplayName&authorEmail=authorEmail&authorId=100&authorName=authorName&authorSlug=authorSlug&pullRequestUrl=http%3A%2F%2Fbitbucket.server%2Fprojects%2FtheProject%2Frepos%2Fthe-Repo-Name%2Fpull-requests%2F10" //
"http://bjurr.se/id=10&action=OPENED&displayName=authorDisplayName&authorEmail=authorEmail&authorId=100&authorName=authorName&authorSlug=authorSlug&pullRequestUrl=http%3A%2F%2Fbitbucket.server%2Fprojects%2FtheProject%2Frepos%2Fthe-repo-name%2Fpull-requests%2F10" //
);
}

Expand Down

0 comments on commit c19f72f

Please sign in to comment.