1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-25 08:59:31 -05:00

Fix wrong transfer hint (#30889)

Fix #30187

(cherry picked from commit f5f921c09555f5b31226fc31bbbb463649d0bfdc)
This commit is contained in:
Lunny Xiao 2024-05-08 21:17:11 +08:00 committed by Earl Warren
parent 12b6bcaf05
commit 9bc391250d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -798,6 +798,7 @@ func SettingsPost(ctx *context.Context) {
ctx.Repo.GitRepo = nil ctx.Repo.GitRepo = nil
} }
oldFullname := repo.FullName()
if err := repo_service.StartRepositoryTransfer(ctx, ctx.Doer, newOwner, repo, nil); err != nil { if err := repo_service.StartRepositoryTransfer(ctx, ctx.Doer, newOwner, repo, nil); err != nil {
if errors.Is(err, user_model.ErrBlockedByUser) { if errors.Is(err, user_model.ErrBlockedByUser) {
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_blocked_doer"), tplSettingsOptions, nil) ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_blocked_doer"), tplSettingsOptions, nil)
@ -812,8 +813,13 @@ func SettingsPost(ctx *context.Context) {
return return
} }
log.Trace("Repository transfer process was started: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner) if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer {
ctx.Flash.Success(ctx.Tr("repo.settings.transfer_started", newOwner.DisplayName())) 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") ctx.Redirect(repo.Link() + "/settings")
case "cancel_transfer": case "cancel_transfer":