mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-16 15:02:43 +00:00
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context * remove some unnecessary wrap functions
This commit is contained in:
parent
d81e31ad78
commit
fd7d83ace6
232 changed files with 1463 additions and 2108 deletions
|
@ -103,7 +103,7 @@ func IsCollaborator(ctx *context.APIContext) {
|
|||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
user, err := user_model.GetUserByName(ctx.Params(":collaborator"))
|
||||
user, err := user_model.GetUserByName(ctx, ctx.Params(":collaborator"))
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", err)
|
||||
|
@ -159,7 +159,7 @@ func AddCollaborator(ctx *context.APIContext) {
|
|||
|
||||
form := web.GetForm(ctx).(*api.AddCollaboratorOption)
|
||||
|
||||
collaborator, err := user_model.GetUserByName(ctx.Params(":collaborator"))
|
||||
collaborator, err := user_model.GetUserByName(ctx, ctx.Params(":collaborator"))
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", err)
|
||||
|
@ -218,7 +218,7 @@ func DeleteCollaborator(ctx *context.APIContext) {
|
|||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
collaborator, err := user_model.GetUserByName(ctx.Params(":collaborator"))
|
||||
collaborator, err := user_model.GetUserByName(ctx, ctx.Params(":collaborator"))
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.Error(http.StatusUnprocessableEntity, "", err)
|
||||
|
@ -271,7 +271,7 @@ func GetRepoPermissions(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
collaborator, err := user_model.GetUserByName(ctx.Params(":collaborator"))
|
||||
collaborator, err := user_model.GetUserByName(ctx, ctx.Params(":collaborator"))
|
||||
if err != nil {
|
||||
if user_model.IsErrUserNotExist(err) {
|
||||
ctx.Error(http.StatusNotFound, "GetUserByName", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue