summaryrefslogtreecommitdiffstats
path: root/routers/org/teams.go
diff options
context:
space:
mode:
authorDavid Schneiderbauer <daviian@users.noreply.github.com>2018-06-21 18:00:13 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-06-21 12:00:13 -0400
commit0b3ea428477b9da33f40252e79aafe85b09526f3 (patch)
tree4fccc7dbf7f027331735d7d041bc290db632b744 /routers/org/teams.go
parent46d19c4676efe5201c5de790bcb963bfc93a95c7 (diff)
downloadgitea-0b3ea428477b9da33f40252e79aafe85b09526f3.tar.gz
gitea-0b3ea428477b9da33f40252e79aafe85b09526f3.zip
hide issues from org private repos w/o team assignment (#4034)
Diffstat (limited to 'routers/org/teams.go')
-rw-r--r--routers/org/teams.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/routers/org/teams.go b/routers/org/teams.go
index d894c86614..87bfb8596a 100644
--- a/routers/org/teams.go
+++ b/routers/org/teams.go
@@ -182,7 +182,14 @@ func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
Authorize: models.ParseAccessMode(form.Permission),
}
if t.Authorize < models.AccessModeAdmin {
- t.UnitTypes = form.Units
+ var units = make([]*models.TeamUnit, 0, len(form.Units))
+ for _, tp := range form.Units {
+ units = append(units, &models.TeamUnit{
+ OrgID: ctx.Org.Organization.ID,
+ Type: tp,
+ })
+ }
+ t.Units = units
}
ctx.Data["Team"] = t
@@ -264,9 +271,17 @@ func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
}
t.Description = form.Description
if t.Authorize < models.AccessModeAdmin {
- t.UnitTypes = form.Units
+ var units = make([]models.TeamUnit, 0, len(form.Units))
+ for _, tp := range form.Units {
+ units = append(units, models.TeamUnit{
+ OrgID: t.OrgID,
+ TeamID: t.ID,
+ Type: tp,
+ })
+ }
+ models.UpdateTeamUnits(t, units)
} else {
- t.UnitTypes = nil
+ models.UpdateTeamUnits(t, nil)
}
if ctx.HasError() {