Skip to content

Commit 7824d70

Browse files
authored
fix: Add missing NotificationSetting to newTeamNoParent (#3302)
1 parent c0f593d commit 7824d70

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

github/teams.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -206,26 +206,28 @@ func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam)
206206
// "parent_team_id" field will be null. It is for internal use
207207
// only and should not be exported.
208208
type newTeamNoParent struct {
209-
Name string `json:"name"`
210-
Description *string `json:"description,omitempty"`
211-
Maintainers []string `json:"maintainers,omitempty"`
212-
RepoNames []string `json:"repo_names,omitempty"`
213-
ParentTeamID *int64 `json:"parent_team_id"` // This will be "null"
214-
Privacy *string `json:"privacy,omitempty"`
215-
LDAPDN *string `json:"ldap_dn,omitempty"`
209+
Name string `json:"name"`
210+
Description *string `json:"description,omitempty"`
211+
Maintainers []string `json:"maintainers,omitempty"`
212+
RepoNames []string `json:"repo_names,omitempty"`
213+
ParentTeamID *int64 `json:"parent_team_id"` // This will be "null"
214+
NotificationSetting *string `json:"notification_setting,omitempty"`
215+
Privacy *string `json:"privacy,omitempty"`
216+
LDAPDN *string `json:"ldap_dn,omitempty"`
216217
}
217218

218219
// copyNewTeamWithoutParent is used to set the "parent_team_id"
219220
// field to "null" after copying the other fields from a NewTeam.
220221
// It is for internal use only and should not be exported.
221222
func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent {
222223
return &newTeamNoParent{
223-
Name: team.Name,
224-
Description: team.Description,
225-
Maintainers: team.Maintainers,
226-
RepoNames: team.RepoNames,
227-
Privacy: team.Privacy,
228-
LDAPDN: team.LDAPDN,
224+
Name: team.Name,
225+
Description: team.Description,
226+
Maintainers: team.Maintainers,
227+
RepoNames: team.RepoNames,
228+
NotificationSetting: team.NotificationSetting,
229+
Privacy: team.Privacy,
230+
LDAPDN: team.LDAPDN,
229231
}
230232
}
231233

github/teams_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func TestTeamsService_EditTeamByID(t *testing.T) {
277277
func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) {
278278
client, mux, _ := setup(t)
279279

280-
input := NewTeam{Name: "n", Privacy: String("closed")}
280+
input := NewTeam{Name: "n", NotificationSetting: String("notifications_enabled"), Privacy: String("closed")}
281281
var body string
282282

283283
mux.HandleFunc("/organizations/1/team/1", func(w http.ResponseWriter, r *http.Request) {
@@ -308,7 +308,7 @@ func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) {
308308
t.Errorf("Teams.EditTeamByID returned %+v, want %+v", team, want)
309309
}
310310

311-
if want := `{"name":"n","parent_team_id":null,"privacy":"closed"}` + "\n"; body != want {
311+
if want := `{"name":"n","parent_team_id":null,"notification_setting":"notifications_enabled","privacy":"closed"}` + "\n"; body != want {
312312
t.Errorf("Teams.EditTeamByID body = %+v, want %+v", body, want)
313313
}
314314
}
@@ -359,7 +359,7 @@ func TestTeamsService_EditTeamBySlug(t *testing.T) {
359359
func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) {
360360
client, mux, _ := setup(t)
361361

362-
input := NewTeam{Name: "n", Privacy: String("closed")}
362+
input := NewTeam{Name: "n", NotificationSetting: String("notifications_disabled"), Privacy: String("closed")}
363363
var body string
364364

365365
mux.HandleFunc("/orgs/o/teams/s", func(w http.ResponseWriter, r *http.Request) {
@@ -390,7 +390,7 @@ func TestTeamsService_EditTeamBySlug_RemoveParent(t *testing.T) {
390390
t.Errorf("Teams.EditTeam returned %+v, want %+v", team, want)
391391
}
392392

393-
if want := `{"name":"n","parent_team_id":null,"privacy":"closed"}` + "\n"; body != want {
393+
if want := `{"name":"n","parent_team_id":null,"notification_setting":"notifications_disabled","privacy":"closed"}` + "\n"; body != want {
394394
t.Errorf("Teams.EditTeam body = %+v, want %+v", body, want)
395395
}
396396
}

0 commit comments

Comments
 (0)