#2780 code clean up

This commit is contained in:
Unknwon 2016-08-11 11:35:46 -07:00
parent b6c14f8b21
commit 7e9b42c87d
5 changed files with 13 additions and 21 deletions

View file

@ -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()