Refactor pull request view (4) (#37451)
Use JSON attribute instead of inline script --------- Co-authored-by: Nicolas <bircni@icloud.com>
This commit is contained in:
@@ -164,12 +164,13 @@ func getPullInfo(ctx *context.Context) (issue *issues_model.Issue, ok bool) {
|
||||
func (prInfo *pullRequestViewInfo) setTemplateDataMergeTarget(ctx *context.Context) {
|
||||
pull := prInfo.issue.PullRequest
|
||||
if ctx.Repo.Owner.Name == pull.MustHeadUserName(ctx) {
|
||||
ctx.Data["HeadTarget"] = pull.HeadBranch
|
||||
prInfo.headTarget = pull.HeadBranch
|
||||
} else if pull.HeadRepo == nil {
|
||||
ctx.Data["HeadTarget"] = ctx.Locale.Tr("repo.pull.deleted_branch", pull.HeadBranch)
|
||||
prInfo.headTarget = ctx.Locale.TrString("repo.pull.deleted_branch", pull.HeadBranch)
|
||||
} else {
|
||||
ctx.Data["HeadTarget"] = pull.MustHeadUserName(ctx) + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch
|
||||
prInfo.headTarget = pull.MustHeadUserName(ctx) + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch
|
||||
}
|
||||
ctx.Data["HeadTarget"] = prInfo.headTarget
|
||||
ctx.Data["BaseTarget"] = pull.BaseBranch
|
||||
headBranchLink := ""
|
||||
if pull.Flow == issues_model.PullRequestFlowGithub {
|
||||
@@ -268,6 +269,11 @@ type pullMergeBoxData struct {
|
||||
HasOverridableBlockers bool
|
||||
CanMergeNow bool
|
||||
|
||||
MergeFormProps map[string]any
|
||||
ShowPullCommands bool
|
||||
ShowMergeInstructions bool
|
||||
AutodetectManualMerge bool
|
||||
|
||||
// don't expose unneeded fields to templates, need more refactoring changes
|
||||
hasStatusCheckBlocker bool
|
||||
isPullBranchDeletable bool
|
||||
@@ -289,6 +295,7 @@ type pullRequestViewInfo struct {
|
||||
|
||||
IsPullRequestBroken bool
|
||||
HeadBranchCommitID string
|
||||
headTarget string // for display purpose only
|
||||
|
||||
CompareInfo git_service.CompareInfo
|
||||
ProtectedBranchRule *git_model.ProtectedBranch
|
||||
|
||||
Reference in New Issue
Block a user