refactor(templates): remove ctxData from tmpl files, use ctx.RootData instead (#37567)
Sub-templates have direct access to `ctx.RootData` (the root data map), so there is no need for callers to explicitly pass it as `ctxData` via `dict`. Also fix #37569 by the way --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -86,7 +86,7 @@
|
||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||
{{end}}
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{if .Issue.IsPull}}
|
||||
{{ctx.Locale.Tr "repo.pulls.reopened_at" .EventTag $createdStr}}
|
||||
{{else}}
|
||||
@@ -101,7 +101,7 @@
|
||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||
{{end}}
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{if .Issue.IsPull}}
|
||||
{{ctx.Locale.Tr "repo.pulls.closed_at" .EventTag $createdStr}}
|
||||
{{else}}
|
||||
@@ -116,7 +116,7 @@
|
||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||
{{end}}
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
|
||||
{{if eq $.Issue.PullRequest.Status 3}}
|
||||
{{ctx.Locale.Tr "repo.issues.comment_manually_pull_merged_at" (HTMLFormat `<a class="ui sha" href="%[1]s"><b>%[2]s</b></a>` $link (ShortSha $.Issue.PullRequest.MergedCommitID)) (HTMLFormat "<b>%[1]s</b>" $.BaseTarget) $createdStr}}
|
||||
@@ -256,7 +256,7 @@
|
||||
{{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}}
|
||||
{{ctx.Locale.Tr "repo.issues.stop_tracking_history" $timeStr $createdStr}}
|
||||
</span>
|
||||
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_delete_time" dict "comment" .}}
|
||||
</div>
|
||||
{{else if eq .Type 14}}
|
||||
<div class="timeline-item event" id="{{.HashTag}}">
|
||||
@@ -268,7 +268,7 @@
|
||||
{{if not $timeStr}}{{$timeStr = .Content|Sec2Hour}}{{end}}
|
||||
{{ctx.Locale.Tr "repo.issues.add_time_history" $timeStr $createdStr}}
|
||||
</span>
|
||||
{{template "repo/issue/view_content/comments_delete_time" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_delete_time" dict "comment" .}}
|
||||
</div>
|
||||
{{else if eq .Type 15}}
|
||||
<div class="timeline-item event" id="{{.HashTag}}">
|
||||
@@ -380,7 +380,7 @@
|
||||
{{- end -}}
|
||||
</span>
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{if eq $reviewType 1}}
|
||||
{{ctx.Locale.Tr "repo.issues.review.approve" $createdStr}}
|
||||
{{else if eq $reviewType 3}}
|
||||
@@ -490,7 +490,7 @@
|
||||
{{template "shared/user/avatarlink" dict "user" .Poster}}
|
||||
{{end}}
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{ctx.Locale.Tr "repo.pulls.change_target_branch_at" .OldRef .NewRef $createdStr}}
|
||||
</span>
|
||||
</div>
|
||||
@@ -665,7 +665,7 @@
|
||||
<div class="timeline-item event" id="{{.HashTag}}">
|
||||
<span class="badge">{{svg "octicon-git-merge" 16}}</span>
|
||||
<span class="comment-text-line">
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "ctxData" $ "comment" .}}
|
||||
{{template "repo/issue/view_content/comments_authorlink" dict "comment" .}}
|
||||
{{if eq .Type 34}}{{ctx.Locale.Tr "repo.pulls.auto_merge_newly_scheduled_comment" $createdStr}}
|
||||
{{else}}{{ctx.Locale.Tr "repo.pulls.auto_merge_canceled_schedule_comment" $createdStr}}{{end}}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user