mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Don't fail silently if trying to add a collaborator twice (#4533)
* don't fail silently if trying to add a collaborator twice * fix translation text * added collaborator test * improvee testcases * Added tests to make sure a collaborator cannot be added twice
This commit is contained in:
committed by
Lunny Xiao
parent
7cb1c1cf20
commit
c7a6ee5c0b
@@ -401,6 +401,12 @@ func CollaborationPost(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
if got, err := ctx.Repo.Repository.IsCollaborator(u.ID); err == nil && got {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.add_collaborator_duplicate"))
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/settings/collaboration")
|
||||
return
|
||||
}
|
||||
|
||||
if err = ctx.Repo.Repository.AddCollaborator(u); err != nil {
|
||||
ctx.ServerError("AddCollaborator", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user