summaryrefslogtreecommitdiffstats
path: root/models/access.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/access.go')
-rw-r--r--models/access.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/models/access.go b/models/access.go
index c509867062..4b72a752b2 100644
--- a/models/access.go
+++ b/models/access.go
@@ -207,7 +207,12 @@ func (repo *Repository) refreshAccesses(e Engine, accessMap map[int64]*userAcces
// Delete old accesses and insert new ones for repository.
if _, err = e.Delete(&Access{RepoID: repo.ID}); err != nil {
return fmt.Errorf("delete old accesses: %v", err)
- } else if _, err = e.Insert(newAccesses); err != nil {
+ }
+ if len(newAccesses) == 0 {
+ return nil
+ }
+
+ if _, err = e.Insert(newAccesses); err != nil {
return fmt.Errorf("insert new accesses: %v", err)
}
return nil