Fix bug
This commit is contained in:
parent
9f9f4882f9
commit
1dfa78538e
3 changed files with 10 additions and 27 deletions
|
@ -150,14 +150,13 @@ type PullRequest struct {
|
|||
Issue *Issue `xorm:"-"`
|
||||
Index int64
|
||||
|
||||
HeadRepoID int64 `xorm:"INDEX"`
|
||||
HeadRepo *repo_model.Repository `xorm:"-"`
|
||||
BaseRepoID int64 `xorm:"INDEX"`
|
||||
BaseRepo *repo_model.Repository `xorm:"-"`
|
||||
HeadBranch string
|
||||
HeadCommitID string `xorm:"-"`
|
||||
BaseBranch string
|
||||
// ProtectedBranch *git_model.ProtectedBranch `xorm:"-"`
|
||||
HeadRepoID int64 `xorm:"INDEX"`
|
||||
HeadRepo *repo_model.Repository `xorm:"-"`
|
||||
BaseRepoID int64 `xorm:"INDEX"`
|
||||
BaseRepo *repo_model.Repository `xorm:"-"`
|
||||
HeadBranch string
|
||||
HeadCommitID string `xorm:"-"`
|
||||
BaseBranch string
|
||||
MergeBase string `xorm:"VARCHAR(40)"`
|
||||
AllowMaintainerEdit bool `xorm:"NOT NULL DEFAULT false"`
|
||||
|
||||
|
@ -305,23 +304,6 @@ func (pr *PullRequest) LoadIssueCtx(ctx context.Context) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// LoadProtectedBranchRules loads the protected branch of the base branch
|
||||
/*func (pr *PullRequest) LoadProtectedBranchRules(ctx context.Context) (err error) {
|
||||
if pr.ProtectedBranch == nil {
|
||||
if pr.BaseRepo == nil {
|
||||
if pr.BaseRepoID == 0 {
|
||||
return nil
|
||||
}
|
||||
pr.BaseRepo, err = repo_model.GetRepositoryByIDCtx(ctx, pr.BaseRepoID)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
pr.ProtectedBranch, err = git_model.GetFirstMatchProtectedBranchRule(ctx, pr.BaseRepo.ID, pr.BaseBranch)
|
||||
}
|
||||
return err
|
||||
}*/
|
||||
|
||||
// ReviewCount represents a count of Reviews
|
||||
type ReviewCount struct {
|
||||
IssueID int64
|
||||
|
|
|
@ -1641,6 +1641,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
if ctx.Doer != nil {
|
||||
showMergeInstructions = pb.CanUserPush(ctx.Doer.ID)
|
||||
}
|
||||
ctx.Data["ProtectedBranch"] = pb
|
||||
ctx.Data["IsBlockedByApprovals"] = !issues_model.HasEnoughApprovals(ctx, pb, pull)
|
||||
ctx.Data["IsBlockedByRejection"] = issues_model.MergeBlockedByRejectedReview(ctx, pb, pull)
|
||||
ctx.Data["IsBlockedByOfficialReviewRequests"] = issues_model.MergeBlockedByOfficialReviewRequests(ctx, pb, pull)
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
{{if .IsBlockedByApprovals}}
|
||||
<div class="item">
|
||||
<i class="icon icon-octicon">{{svg "octicon-x"}}</i>
|
||||
{{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
|
||||
{{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
|
||||
</div>
|
||||
{{else if .IsBlockedByRejection}}
|
||||
<div class="item">
|
||||
|
@ -440,7 +440,7 @@
|
|||
{{if .IsBlockedByApprovals}}
|
||||
<div class="item text red">
|
||||
{{svg "octicon-x"}}
|
||||
{{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .Issue.PullRequest.ProtectedBranch.RequiredApprovals}}
|
||||
{{$.locale.Tr "repo.pulls.blocked_by_approvals" .GrantedApprovals .ProtectedBranch.RequiredApprovals}}
|
||||
</div>
|
||||
{{else if .IsBlockedByRejection}}
|
||||
<div class="item text red">
|
||||
|
|
Loading…
Add table
Reference in a new issue