summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/collaborators.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/collaborators.go')
-rw-r--r--routers/api/v1/repo/collaborators.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 497255a474..a4fc1d8f11 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -13,6 +13,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/convert"
api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/routers/api/v1/utils"
)
@@ -111,7 +112,7 @@ func IsCollaborator(ctx *context.APIContext) {
}
// AddCollaborator add a collaborator to a repository
-func AddCollaborator(ctx *context.APIContext, form api.AddCollaboratorOption) {
+func AddCollaborator(ctx *context.APIContext) {
// swagger:operation PUT /repos/{owner}/{repo}/collaborators/{collaborator} repository repoAddCollaborator
// ---
// summary: Add a collaborator to a repository
@@ -143,6 +144,8 @@ func AddCollaborator(ctx *context.APIContext, form api.AddCollaboratorOption) {
// "422":
// "$ref": "#/responses/validationError"
+ form := web.GetForm(ctx).(*api.AddCollaboratorOption)
+
collaborator, err := models.GetUserByName(ctx.Params(":collaborator"))
if err != nil {
if models.IsErrUserNotExist(err) {