aboutsummaryrefslogtreecommitdiffstats
path: root/models/org_team.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-01-09 14:15:14 +0100
committerzeripath <art27@cantab.net>2020-01-09 13:15:14 +0000
commit1080c768d33a2c4846467d2e2913df87237b8b23 (patch)
tree0c9fd7f0da7e53bb6eeffa65aec793823bd8eb89 /models/org_team.go
parent71fe01897743915b8fc8bb8d07f44ee6214d1e50 (diff)
downloadgitea-1080c768d33a2c4846467d2e2913df87237b8b23.tar.gz
gitea-1080c768d33a2c4846467d2e2913df87237b8b23.zip
[API] orgEditTeam make Fields optional (#9556)
* API: orgEditTeam make Fields optional * add TestCase * Update integrations/api_team_test.go * suggestions from lafriks use len() to check if string is empty Co-Authored-By: Lauris BH <lauris@nix.lv> * change ... * use Where not ID to get mssql * add return and code format * fix test * fix test ... null pointer exept * update specific colums * only specific colums too Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/org_team.go')
-rw-r--r--models/org_team.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/models/org_team.go b/models/org_team.go
index 63c6e11636..0c0a1e7b79 100644
--- a/models/org_team.go
+++ b/models/org_team.go
@@ -590,7 +590,8 @@ func UpdateTeam(t *Team, authChanged bool, includeAllChanged bool) (err error) {
return ErrTeamAlreadyExist{t.OrgID, t.LowerName}
}
- if _, err = sess.ID(t.ID).AllCols().Update(t); err != nil {
+ if _, err = sess.ID(t.ID).Cols("name", "lower_name", "description",
+ "can_create_org_repo", "authorize", "includes_all_repositories").Update(t); err != nil {
return fmt.Errorf("update: %v", err)
}
@@ -605,8 +606,7 @@ func UpdateTeam(t *Team, authChanged bool, includeAllChanged bool) (err error) {
Delete(new(TeamUnit)); err != nil {
return err
}
-
- if _, err = sess.Insert(&t.Units); err != nil {
+ if _, err = sess.Cols("org_id", "team_id", "type").Insert(&t.Units); err != nil {
errRollback := sess.Rollback()
if errRollback != nil {
log.Error("UpdateTeam sess.Rollback: %v", errRollback)