Skip to content

Commit

Permalink
Fix wrong transfer hint (#30889) (#30900)
Browse files Browse the repository at this point in the history
Backport #30889 by @lunny

Fix #30187

Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
GiteaBot and lunny authored May 8, 2024
1 parent ec3f5f9 commit 271e874
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions routers/web/repo/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ func SettingsPost(ctx *context.Context) {
ctx.Repo.GitRepo = nil
}

oldFullname := repo.FullName()
if err := repo_service.StartRepositoryTransfer(ctx, ctx.Doer, newOwner, repo, nil); err != nil {
if repo_model.IsErrRepoAlreadyExist(err) {
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), tplSettingsOptions, nil)
Expand All @@ -803,8 +804,13 @@ func SettingsPost(ctx *context.Context) {
return
}

log.Trace("Repository transfer process was started: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_started", newOwner.DisplayName()))
if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer {
log.Trace("Repository transfer process was started: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner)
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_started", newOwner.DisplayName()))
} else {
log.Trace("Repository transferred: %s -> %s", oldFullname, ctx.Repo.Repository.FullName())
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed"))
}
ctx.Redirect(repo.Link() + "/settings")

case "cancel_transfer":
Expand Down

0 comments on commit 271e874

Please sign in to comment.