diff --git a/src/main/scala/gitbucket/core/view/helpers.scala b/src/main/scala/gitbucket/core/view/helpers.scala index b364b1e..4cb6f29 100644 --- a/src/main/scala/gitbucket/core/view/helpers.scala +++ b/src/main/scala/gitbucket/core/view/helpers.scala @@ -6,6 +6,7 @@ import com.nimbusds.jose.util.JSONObjectUtils import gitbucket.core.controller.Context import gitbucket.core.model.CommitState +import gitbucket.core.model.PullRequest import gitbucket.core.plugin.{PluginRegistry, RenderRequest} import gitbucket.core.service.RepositoryService.RepositoryInfo import gitbucket.core.service.{RepositoryService, RequestCache} @@ -274,6 +275,18 @@ def url(userName: String)(implicit context: Context): String = s"${context.path}/${encodeRefName(userName)}" /** + * Generates the url to the pull request base branch. + */ + def basePRBranchUrl(pullreq: PullRequest)(implicit context: Context): String = + s"${context.path}/${encodeRefName(pullreq.userName)}/${encodeRefName(pullreq.repositoryName)}/tree/${encodeRefName(pullreq.branch)}" + + /** + * Generates the url to the pull request branch. + */ + def requestPRBranchUrl(pullreq: PullRequest)(implicit context: Context): String = + s"${context.path}/${encodeRefName(pullreq.requestUserName)}/${encodeRefName(pullreq.repositoryName)}/tree/${encodeRefName(pullreq.requestBranch)}" + + /** * Returns the url to the root of assets. */ @deprecated("Use assets(path: String)(implicit context: Context) instead.", "4.11.0") diff --git a/src/main/twirl/gitbucket/core/pulls/menu.scala.html b/src/main/twirl/gitbucket/core/pulls/menu.scala.html index 88271d9..ed43495 100644 --- a/src/main/twirl/gitbucket/core/pulls/menu.scala.html +++ b/src/main/twirl/gitbucket/core/pulls/menu.scala.html @@ -47,8 +47,8 @@ @helpers.user(comment.commentedUserName, styleClass = "username strong") merged @commits.size @helpers.plural(commits.size, "commit") - into @pullreq.userName:@pullreq.branch - from @pullreq.requestUserName:@pullreq.requestBranch + into @pullreq.userName:@pullreq.branch + from @pullreq.requestUserName:@pullreq.requestBranch @gitbucket.core.helper.html.datetimeago(comment.registeredDate) }.getOrElse { @@ -56,8 +56,8 @@ @helpers.user(issue.openedUserName, styleClass = "username strong") wants to merge @commits.size @helpers.plural(commits.size, "commit") - into @pullreq.userName:@pullreq.branch - from @pullreq.requestUserName:@pullreq.requestBranch + into @pullreq.userName:@pullreq.branch + from @pullreq.requestUserName:@pullreq.requestBranch } } else { @@ -65,8 +65,8 @@ @helpers.user(issue.openedUserName, styleClass = "username strong") wants to merge @commits.size @helpers.plural(commits.size, "commit") - into @pullreq.userName:@pullreq.branch - from @pullreq.requestUserName:@pullreq.requestBranch + into @pullreq.userName:@pullreq.branch + from @pullreq.requestUserName:@pullreq.requestBranch }