Backport #30889 by @lunny Fix #30187 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> (cherry picked from commit 271e8748a2035ebc836cc2d1e03f4e68b063697e)
This commit is contained in:
parent
7e81775184
commit
8f8d85da47
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
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()))
|
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":
|
||||||
|
|
Loading…
Reference in a new issue