Skip to content

Commit 3611a3e

Browse files
lunnyappleboy
authored andcommitted
fix bug to deny to add orgnization as a member of an orgnization or team (#1815)
1 parent 39348cd commit 3611a3e

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ enterred_invalid_owner_name = Please ensure that the owner name you entered is c
259259
enterred_invalid_password = Please ensure the that password you entered is correct.
260260
user_not_exist = The user does not exist.
261261
last_org_owner = Removing the last user from the owner team is not allowed because there must always be at least one owner in any given organization.
262+
cannot_add_org_to_team = Organization cannot be added as a team member.
263+
cannot_invite_org_to_org = Organization cannot be invited as an organization member.
262264
263265
invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s
264266
invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s

routers/org/members.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ func Invitation(ctx *context.Context) {
114114
return
115115
}
116116

117+
if u.IsOrganization() {
118+
ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org"))
119+
ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
120+
return
121+
}
122+
117123
if err = org.AddMember(u.ID); err != nil {
118124
ctx.Handle(500, " AddMember", err)
119125
return

routers/org/teams.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ func TeamsAction(ctx *context.Context) {
8888
return
8989
}
9090

91+
if u.IsOrganization() {
92+
ctx.Flash.Error(ctx.Tr("form.cannot_add_org_to_team"))
93+
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName)
94+
return
95+
}
96+
9197
err = ctx.Org.Team.AddMember(u.ID)
9298
page = "team"
9399
}

0 commit comments

Comments
 (0)