diff options
Diffstat (limited to 'models')
-rw-r--r-- | models/repo_collaboration.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/models/repo_collaboration.go b/models/repo_collaboration.go index 2a530f8752..f4b23f9ebe 100644 --- a/models/repo_collaboration.go +++ b/models/repo_collaboration.go @@ -29,7 +29,7 @@ func (c *Collaboration) ModeI18nKey() string { } } -// AddCollaborator adds new collaboration relation between an individual and a repository. +// AddCollaborator adds new collaboration to a repository with default access mode. func (repo *Repository) AddCollaborator(u *User) error { collaboration := &Collaboration{ RepoID: repo.ID, @@ -120,6 +120,9 @@ func (repo *Repository) ChangeCollaborationAccessMode(uid int64, mode AccessMode return nil } + if collaboration.Mode == mode { + return nil + } collaboration.Mode = mode sess := x.NewSession() |