refactor some functions to support ctx as first parameter (#21878)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
Lunny Xiao 2022-12-03 10:48:26 +08:00 committed by GitHub
parent 8698458f48
commit 0a7d3ff786
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
145 changed files with 360 additions and 369 deletions

View file

@ -66,7 +66,7 @@ func Migrate(ctx *context.APIContext) {
if len(form.RepoOwner) != 0 {
repoOwner, err = user_model.GetUserByName(ctx, form.RepoOwner)
} else if form.RepoOwnerID != 0 {
repoOwner, err = user_model.GetUserByID(form.RepoOwnerID)
repoOwner, err = user_model.GetUserByID(ctx, form.RepoOwnerID)
} else {
repoOwner = ctx.Doer
}
@ -211,7 +211,7 @@ func Migrate(ctx *context.APIContext) {
}
log.Trace("Repository migrated: %s/%s", repoOwner.Name, form.RepoName)
ctx.JSON(http.StatusCreated, convert.ToRepo(repo, perm.AccessModeAdmin))
ctx.JSON(http.StatusCreated, convert.ToRepo(ctx, repo, perm.AccessModeAdmin))
}
func handleMigrateError(ctx *context.APIContext, repoOwner *user_model.User, remoteAddr string, err error) {