-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor ctx
in templates
#23105
Refactor ctx
in templates
#23105
Conversation
Marking this as breaking, normally we don't for custom templates, but marking as breaking ensures it'll be mentioned in the blog post. |
I do not think Gitea has promised the template compatibility between releases. The "custom" document says that users should always get matched templates to customize. If the template changes are considered to be breaking, there will be more but not only:
ps: I have no objection for marking this as breaking, as long as if helps changelog/blog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do about the still present PullRequestCtx
?
Good point .... I didn't find it. IMO, luckily, the |
I would like to mark it so that users could know which templates have been changed. And I also think we could put some standards about when should |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #23105 +/- ##
=======================================
Coverage 47.55% 47.55%
=======================================
Files 1140 1140
Lines 151032 151032
=======================================
Hits 71816 71816
- Misses 70712 70714 +2
+ Partials 8504 8502 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
🎺 🤖 |
* giteaofficial/main: Use async await to fix empty quote reply at first time (go-gitea#23168) Fix switched citation format (go-gitea#23250) Improve update-locales script and fix locale processing bug (go-gitea#23240) Refactor `ctx` in templates (go-gitea#23105) Improve frontend guideline (go-gitea#23252) Close the temp file when dumping database to make the temp file can be deleted on Windows (go-gitea#23249) # Conflicts: # templates/repo/issue/view_content/context_menu.tmpl
|
@techknowlogick second ping. |
Before, the
dict "ctx" ...
map is used to pass data between templates.Now, more and more templates need to use real Go context:
ctx
is a Go concept forContext
, misusing it may cause problems, and it makes it difficult to review or refactor.This PR contains 2 major changes:
$
is the same as the.
, so the old labels_sidebar'sroot
is thectx
. So thisctx
could just be removed. bd7f218ctx
toctxData
, and it perfectly matches how it comes from backend:"ctxData": ctx.Data
. 7c01260From now on, there is no
ctx
in templates. There are only:ctxData
for passing dataContext
for Go context