mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	fix bug to deny to add orgnization as a member of an orgnization or team (#1815)
This commit is contained in:
		@@ -259,6 +259,8 @@ enterred_invalid_owner_name = Please ensure that the owner name you entered is c
 | 
				
			|||||||
enterred_invalid_password = Please ensure the that password you entered is correct.
 | 
					enterred_invalid_password = Please ensure the that password you entered is correct.
 | 
				
			||||||
user_not_exist = The user does not exist.
 | 
					user_not_exist = The user does not exist.
 | 
				
			||||||
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.
 | 
					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.
 | 
				
			||||||
 | 
					cannot_add_org_to_team = Organization cannot be added as a team member.
 | 
				
			||||||
 | 
					cannot_invite_org_to_org = Organization cannot be invited as an organization member.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s
 | 
					invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s
 | 
				
			||||||
invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s
 | 
					invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,6 +114,12 @@ func Invitation(ctx *context.Context) {
 | 
				
			|||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if u.IsOrganization() {
 | 
				
			||||||
 | 
								ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org"))
 | 
				
			||||||
 | 
								ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if err = org.AddMember(u.ID); err != nil {
 | 
							if err = org.AddMember(u.ID); err != nil {
 | 
				
			||||||
			ctx.Handle(500, " AddMember", err)
 | 
								ctx.Handle(500, " AddMember", err)
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,6 +88,12 @@ func TeamsAction(ctx *context.Context) {
 | 
				
			|||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if u.IsOrganization() {
 | 
				
			||||||
 | 
								ctx.Flash.Error(ctx.Tr("form.cannot_add_org_to_team"))
 | 
				
			||||||
 | 
								ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName)
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		err = ctx.Org.Team.AddMember(u.ID)
 | 
							err = ctx.Org.Team.AddMember(u.ID)
 | 
				
			||||||
		page = "team"
 | 
							page = "team"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user