Skip to content

Commit cbf4c92

Browse files
committed
an inactive user shouldn't be able to be a collaborator
1 parent a74426d commit cbf4c92

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ settings.transfer_succeed = The repository has been transferred.
10141014
settings.confirm_delete = Delete Repository
10151015
settings.add_collaborator = Add Collaborator
10161016
settings.add_collaborator_success = The collaborator has been added.
1017+
settings.add_collaborator_inactive_user = Cannot add an inactive user as a collaborator.
10171018
settings.delete_collaborator = Remove
10181019
settings.collaborator_deletion = Remove Collaborator
10191020
settings.collaborator_deletion_desc = Removing a collaborator will revoke their access to this repository. Continue?

routers/repo/setting.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,12 @@ func CollaborationPost(ctx *context.Context) {
381381
return
382382
}
383383

384+
if !u.IsActive {
385+
ctx.Flash.Error("cannot add an inactive user as a collaborator")
386+
ctx.Redirect(setting.AppSubURL + ctx.Req.URL.Path)
387+
return
388+
}
389+
384390
// Organization is not allowed to be added as a collaborator.
385391
if u.IsOrganization() {
386392
ctx.Flash.Error(ctx.Tr("repo.settings.org_not_allowed_to_be_collaborator"))

0 commit comments

Comments
 (0)