Allow to add organization members as collaborators on organization owned repositories (#4748)
repository... Fixes #4507
This commit is contained in:
		
							parent
							
								
									a7ee4a6e95
								
							
						
					
					
						commit
						0787056e07
					
				| @ -1053,7 +1053,6 @@ settings.collaborator_deletion_desc = Removing a collaborator will revoke their | |||||||
| settings.remove_collaborator_success = The collaborator has been removed. | settings.remove_collaborator_success = The collaborator has been removed. | ||||||
| settings.search_user_placeholder = Search user… | settings.search_user_placeholder = Search user… | ||||||
| settings.org_not_allowed_to_be_collaborator = Organizations cannot be added as a collaborator. | settings.org_not_allowed_to_be_collaborator = Organizations cannot be added as a collaborator. | ||||||
| settings.user_is_org_member = The user is an organization member who cannot be added as a collaborator. |  | ||||||
| settings.add_webhook = Add Webhook | settings.add_webhook = Add Webhook | ||||||
| settings.add_webhook.invalid_channel_name = Webhook channel name cannot be empty and cannot contain only a # character. | settings.add_webhook.invalid_channel_name = Webhook channel name cannot be empty and cannot contain only a # character. | ||||||
| settings.hooks_desc = Webhooks automatically make HTTP POST requests to a server when certain Gitea events trigger. Read more in the <a target="_blank" rel="noopener noreferrer" href="%s">webhooks guide</a>. | settings.hooks_desc = Webhooks automatically make HTTP POST requests to a server when certain Gitea events trigger. Read more in the <a target="_blank" rel="noopener noreferrer" href="%s">webhooks guide</a>. | ||||||
|  | |||||||
| @ -405,19 +405,6 @@ func CollaborationPost(ctx *context.Context) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Check if user is organization member.
 |  | ||||||
| 	if ctx.Repo.Owner.IsOrganization() { |  | ||||||
| 		isMember, err := ctx.Repo.Owner.IsOrgMember(u.ID) |  | ||||||
| 		if err != nil { |  | ||||||
| 			ctx.ServerError("IsOrgMember", err) |  | ||||||
| 			return |  | ||||||
| 		} else if isMember { |  | ||||||
| 			ctx.Flash.Info(ctx.Tr("repo.settings.user_is_org_member")) |  | ||||||
| 			ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") |  | ||||||
| 			return |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if got, err := ctx.Repo.Repository.IsCollaborator(u.ID); err == nil && got { | 	if got, err := ctx.Repo.Repository.IsCollaborator(u.ID); err == nil && got { | ||||||
| 		ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_duplicate")) | 		ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_duplicate")) | ||||||
| 		ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") | 		ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration") | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user