Skip to content

Commit 9d6f15c

Browse files
committed
add active user check when adding a new collaborator via the api
1 parent bf402c7 commit 9d6f15c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

routers/api/v1/repo/collaborators.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
package repo
66

77
import (
8+
"errors"
9+
810
"code.gitea.io/gitea/models"
911
"code.gitea.io/gitea/modules/context"
1012

@@ -145,6 +147,11 @@ func AddCollaborator(ctx *context.APIContext, form api.AddCollaboratorOption) {
145147
return
146148
}
147149

150+
if !collaborator.IsActive {
151+
ctx.Error(500, "InactiveCollaborator", errors.New("collaborator's account is inactive"))
152+
return
153+
}
154+
148155
if err := ctx.Repo.Repository.AddCollaborator(collaborator); err != nil {
149156
ctx.Error(500, "AddCollaborator", err)
150157
return

0 commit comments

Comments
 (0)