Add form-fetch-action to some forms, fix "fetch action" resp bug#37305
Merged
wxiaoguang merged 13 commits intogo-gitea:mainfrom Apr 20, 2026
Merged
Add form-fetch-action to some forms, fix "fetch action" resp bug#37305wxiaoguang merged 13 commits intogo-gitea:mainfrom
form-fetch-action to some forms, fix "fetch action" resp bug#37305wxiaoguang merged 13 commits intogo-gitea:mainfrom
Conversation
form-fetch-action to some forms
PineBale
commented
Apr 20, 2026
| const isRespJson = resp.headers.get('content-type')?.includes('application/json'); | ||
| const respText = await resp.text(); | ||
| const respJson = isRespJson ? JSON.parse(await resp.text()) : null; | ||
| const respJson = isRespJson ? JSON.parse(respText) : null; |
Contributor
There was a problem hiding this comment.
Oops, good catch, it is a bug (my bug ...)
wxiaoguang
reviewed
Apr 20, 2026
wxiaoguang
approved these changes
Apr 20, 2026
form-fetch-action to some formsform-fetch-action to some forms, fix "fetch actions" resp text bug
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a fetch-action UX bug where some repository settings forms could get stuck “loading” when required fields weren’t filled, and corrects a fetch-action error-handler response parsing bug. It does this by making the affected settings modals submit via form-fetch-action and ensuring the corresponding backend handlers return JSON errors/redirects that the fetch-action framework can consume.
Changes:
- Fix double-consuming the
Responsebody inhandleFetchActionErrorby parsing JSON from the already-readrespText. - Add
form-fetch-actionto repository settings forms (convert mirror/fork, transfer, delete repo, delete wiki). - Switch the relevant settings POST handlers to return
JSONError*/JSONRedirect, and update integration tests + test JSON redirect parsing helper accordingly.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/features/common-fetch-action.ts | Fixes fetch-action error JSON parsing by avoiding a second resp.text() read. |
| templates/repo/settings/options.tmpl | Converts several settings modal forms to form-fetch-action submission. |
| routers/web/repo/setting/setting.go | Updates affected repo settings actions to respond with JSON errors/redirects. |
| modules/test/utils.go | Adjusts ParseJSONRedirect to detect presence of the redirect field via pointer type. |
| tests/integration/repo_visibility_test.go | Updates assertions to match JSON redirect responses. |
| tests/integration/pull_create_test.go | Updates delete-repo helper to expect JSON redirect response. |
| tests/integration/editor_test.go | Updates convert-fork flow to expect JSON redirect response. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
form-fetch-action to some forms, fix "fetch actions" resp text bugform-fetch-action to some forms, fix "fetch action" resp bug
lunny
approved these changes
Apr 20, 2026
silverwind
added a commit
to silverwind/gitea
that referenced
this pull request
Apr 20, 2026
…-lang * origin/main: Update go js dependencies (go-gitea#37312) Update GitHub Actions to latest major versions (go-gitea#37313) Revert "Add WebKit to e2e test matrix (go-gitea#37298)" (go-gitea#37315) Add `form-fetch-action` to some forms, fix "fetch action" resp bug (go-gitea#37305) Move heatmap to first-party code (go-gitea#37262) Use updated yaml fields for snapcraft (go-gitea#37318) Remove dead code identified by `deadcode` tool (go-gitea#37271) Enable strict TypeScript, add `errorMessage` helper (go-gitea#37292) Fix vite manifest update masking build errors (go-gitea#37279) bump snapcraft base (go-gitea#37301) # Conflicts: # web_src/js/modules/errors.ts
silverwind
added a commit
to 6543-forks/gitea
that referenced
this pull request
Apr 21, 2026
…n-better * origin/main: (645 commits) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) Fix bug when accessing user badges (go-gitea#37321) Fix AppFullLink (go-gitea#37325) Update go js dependencies (go-gitea#37312) Update GitHub Actions to latest major versions (go-gitea#37313) Revert "Add WebKit to e2e test matrix (go-gitea#37298)" (go-gitea#37315) Add `form-fetch-action` to some forms, fix "fetch action" resp bug (go-gitea#37305) Move heatmap to first-party code (go-gitea#37262) Use updated yaml fields for snapcraft (go-gitea#37318) Remove dead code identified by `deadcode` tool (go-gitea#37271) Enable strict TypeScript, add `errorMessage` helper (go-gitea#37292) Fix vite manifest update masking build errors (go-gitea#37279) bump snapcraft base (go-gitea#37301) Add WebKit to e2e test matrix (go-gitea#37298) Don't add useless labels which will bother changelog generation (go-gitea#37267) Fix Repository transferring page (go-gitea#37277) ... # Conflicts: # options/locale/locale_en-US.ini # templates/package/content/debian.tmpl
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Apr 22, 2026
* main: (25 commits) Add URL to `Learn more about blocking a user` (go-gitea#37355) fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288) Add event.schedule context for schedule actions task (go-gitea#37320) Fix typos (go-gitea#37346) Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324) Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270) Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338) Fix URL related escaping for oauth2 (go-gitea#37334) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) Fix bug when accessing user badges (go-gitea#37321) Fix AppFullLink (go-gitea#37325) Update go js dependencies (go-gitea#37312) Update GitHub Actions to latest major versions (go-gitea#37313) Revert "Add WebKit to e2e test matrix (go-gitea#37298)" (go-gitea#37315) Add `form-fetch-action` to some forms, fix "fetch action" resp bug (go-gitea#37305) Move heatmap to first-party code (go-gitea#37262) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Some forms with required fields have a bug of being stuck on loading after clicking button without filling the fields. This pr adds some commits to address this issue.
Changes:
form-fetch-actionto some formsRenderWithErrDeprecatedAffected forms:
Before:

After:
1.mp4