diff options
author | Unknwon <u@gogs.io> | 2016-08-11 11:35:46 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-11 11:35:46 -0700 |
commit | 7e9b42c87d2276dec2f1789e1296c2ac51533657 (patch) | |
tree | ce0ed2d071def05218b4f50c3afafc8b87e253dc /models/repo_collaboration.go | |
parent | b6c14f8b21a277576a882061fb772a76e3d4511b (diff) | |
download | gitea-7e9b42c87d2276dec2f1789e1296c2ac51533657.tar.gz gitea-7e9b42c87d2276dec2f1789e1296c2ac51533657.zip |
#2780 code clean up
Diffstat (limited to 'models/repo_collaboration.go')
-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() |