mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-12-27 02:39:53 +01:00
Change branch name text in PR into link (#2394)
This commit is contained in:
@@ -6,6 +6,7 @@ import java.util.{Date, Locale, TimeZone}
|
||||
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}
|
||||
@@ -273,6 +274,18 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
<span class="muted">
|
||||
@helpers.user(comment.commentedUserName, styleClass = "username strong")
|
||||
merged @commits.size @helpers.plural(commits.size, "commit")
|
||||
into <code>@pullreq.userName:@pullreq.branch</code>
|
||||
from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
|
||||
into <code><a href="@helpers.basePRBranchUrl(pullreq)">@pullreq.userName:@pullreq.branch</a></code>
|
||||
from <code><a href="@helpers.requestPRBranchUrl(pullreq)">@pullreq.requestUserName:@pullreq.requestBranch</a></code>
|
||||
@gitbucket.core.helper.html.datetimeago(comment.registeredDate)
|
||||
</span>
|
||||
}.getOrElse {
|
||||
@@ -56,8 +56,8 @@
|
||||
<span class="muted">
|
||||
@helpers.user(issue.openedUserName, styleClass = "username strong")
|
||||
wants to merge @commits.size @helpers.plural(commits.size, "commit")
|
||||
into <code>@pullreq.userName:@pullreq.branch</code>
|
||||
from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
|
||||
into <code><a href="@helpers.basePRBranchUrl(pullreq)">@pullreq.userName:@pullreq.branch</a></code>
|
||||
from <code><a href="@helpers.requestPRBranchUrl(pullreq)">@pullreq.requestUserName:@pullreq.requestBranch</a></code>
|
||||
</span>
|
||||
}
|
||||
} else {
|
||||
@@ -65,8 +65,8 @@
|
||||
<span class="muted">
|
||||
@helpers.user(issue.openedUserName, styleClass = "username strong")
|
||||
wants to merge @commits.size @helpers.plural(commits.size, "commit")
|
||||
into <code>@pullreq.userName:@pullreq.branch</code>
|
||||
from <code>@pullreq.requestUserName:@pullreq.requestBranch</code>
|
||||
into <code><a href="@helpers.basePRBranchUrl(pullreq)">@pullreq.userName:@pullreq.branch</a></code>
|
||||
from <code><a href="@helpers.requestPRBranchUrl(pullreq)">@pullreq.requestUserName:@pullreq.requestBranch</a></code>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user