parent
7ab6c77b41
commit
4c82485424
3 changed files with 41 additions and 6 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// PullRequestType defines pull request type
|
||||
|
@ -638,3 +639,27 @@ func (pr *PullRequest) updateCommitDivergence(e Engine, ahead, behind int) error
|
|||
func (pr *PullRequest) IsSameRepo() bool {
|
||||
return pr.BaseRepoID == pr.HeadRepoID
|
||||
}
|
||||
|
||||
// GetBaseBranchHTMLURL returns the HTML URL of the base branch
|
||||
func (pr *PullRequest) GetBaseBranchHTMLURL() string {
|
||||
if err := pr.LoadBaseRepo(); err != nil {
|
||||
log.Error("LoadBaseRepo: %v", err)
|
||||
return ""
|
||||
}
|
||||
if pr.BaseRepo == nil {
|
||||
return ""
|
||||
}
|
||||
return pr.BaseRepo.HTMLURL() + "/src/branch/" + util.PathEscapeSegments(pr.BaseBranch)
|
||||
}
|
||||
|
||||
// GetHeadBranchHTMLURL returns the HTML URL of the head branch
|
||||
func (pr *PullRequest) GetHeadBranchHTMLURL() string {
|
||||
if err := pr.LoadHeadRepo(); err != nil {
|
||||
log.Error("LoadHeadRepo: %v", err)
|
||||
return ""
|
||||
}
|
||||
if pr.HeadRepo == nil {
|
||||
return ""
|
||||
}
|
||||
return pr.HeadRepo.HTMLURL() + "/src/branch/" + util.PathEscapeSegments(pr.HeadBranch)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue