Skip to content

refactor(templates): remove ctxData from tmpl files, use ctx.RootData instead#37567

Merged
wxiaoguang merged 5 commits into
mainfrom
copilot/remove-ctxdata-usages-from-tmpl-files
May 6, 2026
Merged

refactor(templates): remove ctxData from tmpl files, use ctx.RootData instead#37567
wxiaoguang merged 5 commits into
mainfrom
copilot/remove-ctxdata-usages-from-tmpl-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

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

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 6, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 6, 2026
@wxiaoguang wxiaoguang marked this pull request as ready for review May 6, 2026 14:20
@silverwind
Copy link
Copy Markdown
Member

PR description says "Sub-templates have direct access to ctx.RootData".

Why does it need to pass it via {{template "base/head" ctx.RootData}}?

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label May 6, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 6, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

PR description says "Sub-templates have direct access to ctx.RootData".

Why does it need to pass it via {{template "base/head" ctx.RootData}}?

Because that sub-template doesn't use ctx.RootData yet

@wxiaoguang wxiaoguang enabled auto-merge (squash) May 6, 2026 18:13
@wxiaoguang wxiaoguang merged commit b093c2c into main May 6, 2026
28 checks passed
@wxiaoguang wxiaoguang deleted the copilot/remove-ctxdata-usages-from-tmpl-files branch May 6, 2026 18:21
@GiteaBot GiteaBot added this to the 1.27.0 milestone May 6, 2026
@wxiaoguang wxiaoguang added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label May 6, 2026
silverwind added a commit to silverwind/gitea that referenced this pull request May 8, 2026
* origin/main: (41 commits)
  refactor: only reset a database table when the table's data was changed (go-gitea#37573)
  refactor: lint bare `fill`/`stroke` colors, add vars for git graph color series (go-gitea#37543)
  fix(actions): report individual step status in workflow job API response (go-gitea#37592)
  ci: allow `chore` type in PR title lint (go-gitea#37575)
  refactor: remove obsolete export (go-gitea#37579)
  fix: Invalid UTF-8 commit messages in JSON API responses (go-gitea#37542)
  fix: use consistent GetUser family functions (go-gitea#37553)
  fix(api): return 409 message instead of empty JSON for wrong commit id (go-gitea#37572)
  fix(actions): prevent panic when workflow contains null jobs (go-gitea#37570)
  [skip ci] Updated translations via Crowdin
  refactor: use modernc sqlite driver as default (go-gitea#37562)
  refactor(templates): remove ctxData from tmpl files, use ctx.RootData instead (go-gitea#37567)
  ci: increase renovate frequency and fix RENOVATE_ALLOWED_POST_UPGRADE_COMMANDS (go-gitea#37565)
  fix(deps): update go dependencies (go-gitea#37541)
  refactor(deps): migrate from `nektos/act` fork to `gitea/runner` (go-gitea#37557)
  ci: lint PR titles with commitlint (go-gitea#37498)
  Make ServeSetHeaders default to download attachment if filename exists (go-gitea#37552)
  fix(actions): validate workflow param to prevent 500 error (go-gitea#37546)
  Fix various problems (go-gitea#37547)
  docs: fix 4 typos in CHANGELOG.md (go-gitea#37549)
  ...

# Conflicts:
#	templates/repo/actions/runs_list.tmpl
#	templates/repo/issue/view_content/pull_merge_box.tmpl
#	templates/repo/pulls/status.tmpl
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 8, 2026
* main:
  chore(deps): bump tool deps and pin, update `golangci-lint` (go-gitea#37574)
  build: update pnpm to v11 (go-gitea#37591)
  chore(renovate): detect Makefile tools, enable `go` bumps (go-gitea#37595)
  refactor: only reset a database table when the table's data was changed (go-gitea#37573)
  refactor: lint bare `fill`/`stroke` colors, add vars for git graph color series (go-gitea#37543)
  fix(actions): report individual step status in workflow job API response (go-gitea#37592)
  ci: allow `chore` type in PR title lint (go-gitea#37575)
  refactor: remove obsolete export (go-gitea#37579)
  fix: Invalid UTF-8 commit messages in JSON API responses (go-gitea#37542)
  fix: use consistent GetUser family functions (go-gitea#37553)
  fix(api): return 409 message instead of empty JSON for wrong commit id (go-gitea#37572)
  fix(actions): prevent panic when workflow contains null jobs (go-gitea#37570)
  [skip ci] Updated translations via Crowdin
  refactor: use modernc sqlite driver as default (go-gitea#37562)
  refactor(templates): remove ctxData from tmpl files, use ctx.RootData instead (go-gitea#37567)
  ci: increase renovate frequency and fix RENOVATE_ALLOWED_POST_UPGRADE_COMMANDS (go-gitea#37565)

# Conflicts:
#	models/user/user.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/refactoring Existing code has been cleaned up. There should be no new functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A gap between navbar and repo header

5 participants