summaryrefslogtreecommitdiffstats
path: root/models/org_team.go
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2019-06-12 21:41:28 +0200
committertechknowlogick <techknowlogick@gitea.io>2019-06-12 15:41:28 -0400
commitf9ec2f89f2265bc1371a6c62359de9816534fa6b (patch)
treef48b138a457e5ac6cf843bbb38400926704370f7 /models/org_team.go
parent5832f8d90df2d72cb38698c3e9050f2b29717dc7 (diff)
downloadgitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.tar.gz
gitea-f9ec2f89f2265bc1371a6c62359de9816534fa6b.zip
Add golangci (#6418)
Diffstat (limited to 'models/org_team.go')
-rw-r--r--models/org_team.go31
1 files changed, 24 insertions, 7 deletions
diff --git a/models/org_team.go b/models/org_team.go
index 49d06896e5..dcf0743740 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -287,7 +287,8 @@ func NewTeam(t *Team) (err error) {
has, err := x.ID(t.OrgID).Get(new(User))
if err != nil {
return err
- } else if !has {
+ }
+ if !has {
return ErrOrgNotExist{t.OrgID, ""}
}
@@ -298,7 +299,8 @@ func NewTeam(t *Team) (err error) {
Get(new(Team))
if err != nil {
return err
- } else if has {
+ }
+ if has {
return ErrTeamAlreadyExist{t.OrgID, t.LowerName}
}
@@ -309,7 +311,10 @@ func NewTeam(t *Team) (err error) {
}
if _, err = sess.Insert(t); err != nil {
- sess.Rollback()
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("NewTeam sess.Rollback: %v", errRollback)
+ }
return err
}
@@ -319,14 +324,20 @@ func NewTeam(t *Team) (err error) {
unit.TeamID = t.ID
}
if _, err = sess.Insert(&t.Units); err != nil {
- sess.Rollback()
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("NewTeam sess.Rollback: %v", errRollback)
+ }
return err
}
}
// Update organization number of teams.
if _, err = sess.Exec("UPDATE `user` SET num_teams=num_teams+1 WHERE id = ?", t.OrgID); err != nil {
- sess.Rollback()
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("NewTeam sess.Rollback: %v", errRollback)
+ }
return err
}
return sess.Commit()
@@ -412,7 +423,10 @@ func UpdateTeam(t *Team, authChanged bool) (err error) {
}
if _, err = sess.Insert(&t.Units); err != nil {
- sess.Rollback()
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("UpdateTeam sess.Rollback: %v", errRollback)
+ }
return err
}
}
@@ -841,7 +855,10 @@ func UpdateTeamUnits(team *Team, units []TeamUnit) (err error) {
}
if _, err = sess.Insert(units); err != nil {
- sess.Rollback()
+ errRollback := sess.Rollback()
+ if errRollback != nil {
+ log.Error("UpdateTeamUnits sess.Rollback: %v", errRollback)
+ }
return err
}