mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-04 14:46:57 -05:00
Fix logging of Transfer API (#19456)
- Use the correct fullname's in tracing calls. - Return correct function name in error. Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
parent
c764355676
commit
3ec1b6c223
@ -104,14 +104,16 @@ func Transfer(ctx *context.APIContext) {
|
|||||||
ctx.Repo.GitRepo = nil
|
ctx.Repo.GitRepo = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
oldFullname := ctx.Repo.Repository.FullName()
|
||||||
|
|
||||||
if err := repo_service.StartRepositoryTransfer(ctx.Doer, newOwner, ctx.Repo.Repository, teams); err != nil {
|
if err := repo_service.StartRepositoryTransfer(ctx.Doer, newOwner, ctx.Repo.Repository, teams); err != nil {
|
||||||
if models.IsErrRepoTransferInProgress(err) {
|
if models.IsErrRepoTransferInProgress(err) {
|
||||||
ctx.Error(http.StatusConflict, "CreatePendingRepositoryTransfer", err)
|
ctx.Error(http.StatusConflict, "StartRepositoryTransfer", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if repo_model.IsErrRepoAlreadyExist(err) {
|
if repo_model.IsErrRepoAlreadyExist(err) {
|
||||||
ctx.Error(http.StatusUnprocessableEntity, "CreatePendingRepositoryTransfer", err)
|
ctx.Error(http.StatusUnprocessableEntity, "StartRepositoryTransfer", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,12 +122,12 @@ func Transfer(ctx *context.APIContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer {
|
if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer {
|
||||||
log.Trace("Repository transfer initiated: %s -> %s", ctx.Repo.Repository.FullName(), newOwner.Name)
|
log.Trace("Repository transfer initiated: %s -> %s", oldFullname, ctx.Repo.Repository.FullName())
|
||||||
ctx.JSON(http.StatusCreated, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
|
ctx.JSON(http.StatusCreated, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Trace("Repository transferred: %s -> %s", ctx.Repo.Repository.FullName(), newOwner.Name)
|
log.Trace("Repository transferred: %s -> %s", oldFullname, ctx.Repo.Repository.FullName())
|
||||||
ctx.JSON(http.StatusAccepted, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
|
ctx.JSON(http.StatusAccepted, convert.ToRepo(ctx.Repo.Repository, perm.AccessModeAdmin))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user