Fix Repository transferring page#37277
Conversation
Even if the repo is empty, the transfer remains doable.
|
Why ever would you want to transfer an empty repo |
|
@bircni Whoever’s designed the page did not hide the button for empty
repository either. Sometimes you may wanna do so just because of mistakenly
picking a wrong namespace.
|
It is faster to just recreate the repo in another namespace than transferring it - I personally dont see a use case for transferring an empty repo |
As a matter of fact, it's faster to transfer with admin privilege than recreating repo. 😂 Anyway, imho the page is bugged. A, the transfer button is there for empty repo. B, after clicking the button, in the empty repo, there's just nowhere to cancel the transfer, which raises confusion. C, the redirection after |
|
If other see it as useful they can review. |
|
Overall I think it is good enough, nothing will become worse. By the way, since this part code has been changed, it's a good chance to refactor more, will push some more changes. |
15edd90 to
6c5c2dd
Compare
6c5c2dd to
f82a0ef
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes UX and error-handling issues around repository transfers, especially for empty repositories, by switching transfer actions to the fetch-action (link-action) flow and ensuring action errors return JSON responses consumable by the frontend.
Changes:
- Update repo header transfer controls to use
link-actionbuttons and show a “Transferring…” state when the viewer can’t act. - Refactor
RepoAssignmentto ensure pending transfer metadata is prepared even for empty repositories. - Adjust transfer action handlers to return
JSONRedirect/JSONErrorand add new locale strings for updated messaging.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/repo/header.tmpl | Switch transfer accept/reject UI to fetch-action buttons and add a “Transferring…” disabled state. |
| services/context/repo.go | Refactor RepoAssignment into staged functions; ensure transfer info is prepared for empty repos. |
| routers/web/repo/transfer.go | Return JSONRedirect after accept/reject to support fetch-action navigation. |
| routers/web/repo/repo.go | Make handleActionError return JSON errors for fetch-action callers. |
| options/locale/locale_en-US.json | Add new strings for permission denied + transfer-in-progress messaging; remove unused permission strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Small nit for future: Avoid |
But this case, "basic button" indeed looks better, and it matches the other elements alongside. |
|
Not exactly, they look same on light theme because non-basic buttons on light theme have no distinct bg color, but on dark theme they have. We should fix this too so light mode buttons have a subtly different bg color to match dark theme. |
* main: (25 commits) 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) Stabilize issue-project e2e test, increase timeout factor (go-gitea#37297) Fix Mermaid diagrams failing when node labels contain line breaks (go-gitea#37296) Add project column picker to issue and pull request sidebar (go-gitea#37037) Fix container auth for public instance (go-gitea#37290) Refactor frontend `tw-justify-between` layouts to `flex-left-right` (go-gitea#37291) Update Nix flake (go-gitea#37284) Workflow Artifact Info Hover (go-gitea#37100) [skip ci] Updated translations via Crowdin release notes for 1.26.0 (go-gitea#37282) Enhance GetActionWorkflow to support fallback references (go-gitea#37189) Refactor LDAP tests (go-gitea#37274) Remove `SubmitEvent` polyfill (go-gitea#37276) Upgrade go-git to v5.18.0 (go-gitea#37268) Avoid top-level await (go-gitea#37272) Frontend iframe renderer framework: 3D models, OpenAPI (go-gitea#37233) pull: Fix CODEOWNERS absolute path matching. (go-gitea#37244) Swift registry metadata: preserve more JSON fields and accept empty metadata (go-gitea#37254) ...
…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


While editing frontend, I found some inconsistencies while testing transferring repositories:
redirect_tointemplates/repo/header.tmplis useless.handleActionErrorinrouters/web/repo/repo.go. Therefore, instead of flash message, a blank page will be displayed.This pr adds some commits to resolve all these issues.
Update: see the new changes #37277 (comment)