diff options
Diffstat (limited to 'models/org.go')
-rw-r--r-- | models/org.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/models/org.go b/models/org.go index 5d73cf3ff2..1c74c290e9 100644 --- a/models/org.go +++ b/models/org.go @@ -337,6 +337,9 @@ func RemoveOrgUser(orgId, uid int64) error { if _, err = sess.Delete(access); err != nil { sess.Rollback() return err + } else if err = WatchRepo(u.Id, repo.Id, false); err != nil { + sess.Rollback() + return err } } @@ -513,6 +516,10 @@ func (t *Team) AddRepository(repo *Repository) (err error) { return err } } + if err = WatchRepo(u.Id, repo.Id, true); err != nil { + sess.Rollback() + return err + } } return sess.Commit() } @@ -564,6 +571,9 @@ func (t *Team) RemoveRepository(repoId int64) error { if _, err = sess.Delete(access); err != nil { sess.Rollback() return fmt.Errorf("fail to delete access: %v", err) + } else if err = WatchRepo(u.Id, repo.Id, false); err != nil { + sess.Rollback() + return err } } else if auth < t.Authorize { if err = addAccessWithAuthorize(sess, access, AuthorizeToAccessType(auth)); err != nil { @@ -1029,6 +1039,9 @@ func removeTeamMemberWithSess(orgId, teamId, uid int64, sess *xorm.Session) erro if _, err = sess.Delete(access); err != nil { sess.Rollback() return fmt.Errorf("fail to delete access: %v", err) + } else if err = WatchRepo(u.Id, repo.Id, false); err != nil { + sess.Rollback() + return err } } else if auth < t.Authorize { // Downgrade authorize level. |