Skip to content

Fix Repository transferring page#37277

Merged
silverwind merged 14 commits intogo-gitea:mainfrom
PineBale:patch-transfer-repo
Apr 19, 2026
Merged

Fix Repository transferring page#37277
silverwind merged 14 commits intogo-gitea:mainfrom
PineBale:patch-transfer-repo

Conversation

@PineBale
Copy link
Copy Markdown
Contributor

@PineBale PineBale commented Apr 18, 2026

While editing frontend, I found some inconsistencies while testing transferring repositories:

  • No button for accepting/rejecting/cancelling the transfer of an empty repository.
  • The redirect_to in templates/repo/header.tmpl is useless.
  • There's no redirection when there's an error from handleActionError in routers/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)

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 18, 2026
@bircni
Copy link
Copy Markdown
Member

bircni commented Apr 18, 2026

Why ever would you want to transfer an empty repo

Comment thread templates/repo/header.tmpl Outdated
@PineBale
Copy link
Copy Markdown
Contributor Author

PineBale commented Apr 18, 2026 via email

@bircni
Copy link
Copy Markdown
Member

bircni commented Apr 18, 2026

@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

@PineBale
Copy link
Copy Markdown
Contributor Author

PineBale commented Apr 19, 2026

@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 handleActionError is missing. Even without modifying the template as per #37277 (comment), the redirection issue should be addressed 😔 . I did not find any related issue post.

@bircni
Copy link
Copy Markdown
Member

bircni commented Apr 19, 2026

If other see it as useful they can review.

@PineBale PineBale changed the title Fix Repository transferring Fix Repository transferring page Apr 19, 2026
@wxiaoguang
Copy link
Copy Markdown
Contributor

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.

@wxiaoguang wxiaoguang self-assigned this Apr 19, 2026
@wxiaoguang wxiaoguang marked this pull request as draft April 19, 2026 14:23
@wxiaoguang
Copy link
Copy Markdown
Contributor

wxiaoguang commented Apr 19, 2026

Will explain my changes one by one:

  1. Since we have removed htmx, our fetch-action framework can correctly handle JSONError responses now
    • So "handleActionError" now always use "JSONError" for consistency and better user experiences
  2. Split RepoAssignment in "services/context/repo.go" to small functions
    • To make code easier to maintain and refactor in the future
    • And "repoAssignmentPrepareRepoTransfer" doesn't check "IsEmptya" anymore (as this PR's purpose)
    • It's safe to do so, because these functions are executed for all repo requests, and many of them have tests
  3. Refactor the "accept" and "reject" buttons to our fetch action framework
  4. Still show a disabled button when there is "RepoTransfer"
    • This PR's old approach removes such button, but it is not right.
    • If such button is removed, the old owner won't know that the repo is being transferred.

Screenshots:

image
image

@wxiaoguang wxiaoguang force-pushed the patch-transfer-repo branch 2 times, most recently from 15edd90 to 6c5c2dd Compare April 19, 2026 14:54
@wxiaoguang wxiaoguang force-pushed the patch-transfer-repo branch from 6c5c2dd to f82a0ef Compare April 19, 2026 14:56
@wxiaoguang wxiaoguang requested a review from Copilot April 19, 2026 14:59
@wxiaoguang wxiaoguang marked this pull request as ready for review April 19, 2026 14:59
@wxiaoguang wxiaoguang removed their assignment Apr 19, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-action buttons and show a “Transferring…” state when the viewer can’t act.
  • Refactor RepoAssignment to ensure pending transfer metadata is prepared even for empty repositories.
  • Adjust transfer action handlers to return JSONRedirect/JSONError and 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.

Comment thread routers/web/repo/repo.go
Comment thread services/context/repo.go
Comment thread services/context/repo.go Outdated
@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 Apr 19, 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 Apr 19, 2026
@wxiaoguang wxiaoguang requested a review from Copilot April 19, 2026 15:49

This comment was marked as resolved.

@wxiaoguang wxiaoguang added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 19, 2026
@silverwind
Copy link
Copy Markdown
Member

silverwind commented Apr 19, 2026

Small nit for future: Avoid basic buttons, instead use regular button with colored text. Looks better. Could do a full-codebase refactor later.

@silverwind silverwind enabled auto-merge (squash) April 19, 2026 17:28
@wxiaoguang
Copy link
Copy Markdown
Contributor

Small nit for future: Avoid basic buttons, instead use regular button with colored text. Looks better. Could do a full-codebase refactor later.

But this case, "basic button" indeed looks better, and it matches the other elements alongside.

#37277 (comment)

@silverwind
Copy link
Copy Markdown
Member

silverwind commented Apr 19, 2026

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.

@silverwind silverwind merged commit 99cd709 into go-gitea:main Apr 19, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.27.0 milestone Apr 19, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 19, 2026
@PineBale PineBale deleted the patch-transfer-repo branch April 19, 2026 18:27
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 20, 2026
* 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)
  ...
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
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants