summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/transfer.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/transfer.go')
-rw-r--r--routers/api/v1/repo/transfer.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/api/v1/repo/transfer.go b/routers/api/v1/repo/transfer.go
index b1271b7721..b52f16f906 100644
--- a/routers/api/v1/repo/transfer.go
+++ b/routers/api/v1/repo/transfer.go
@@ -93,7 +93,12 @@ func Transfer(ctx *context.APIContext, opts api.TransferRepoOption) {
}
}
- if err = repo_service.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
+ if err = repo_service.StartRepositoryTransfer(ctx.User, newOwner, ctx.Repo.Repository, teams); err != nil {
+ if models.IsErrCancelled(err) {
+ ctx.Error(http.StatusForbidden, "transfer", "user has no right to create repo for new owner")
+ return
+ }
+
ctx.InternalServerError(err)
return
}