+
Skip to content

fix: Add missing NotificationSetting to newTeamNoParent #3302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions github/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,26 +206,28 @@ func (s *TeamsService) CreateTeam(ctx context.Context, org string, team NewTeam)
// "parent_team_id" field will be null. It is for internal use
// only and should not be exported.
type newTeamNoParent struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Maintainers []string `json:"maintainers,omitempty"`
RepoNames []string `json:"repo_names,omitempty"`
ParentTeamID *int64 `json:"parent_team_id"` // This will be "null"
Privacy *string `json:"privacy,omitempty"`
LDAPDN *string `json:"ldap_dn,omitempty"`
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Maintainers []string `json:"maintainers,omitempty"`
RepoNames []string `json:"repo_names,omitempty"`
ParentTeamID *int64 `json:"parent_team_id"` // This will be "null"
NotificationSetting *string `json:"notification_setting,omitempty"`
Privacy *string `json:"privacy,omitempty"`
LDAPDN *string `json:"ldap_dn,omitempty"`
}

// copyNewTeamWithoutParent is used to set the "parent_team_id"
// field to "null" after copying the other fields from a NewTeam.
// It is for internal use only and should not be exported.
func copyNewTeamWithoutParent(team *NewTeam) *newTeamNoParent {
return &newTeamNoParent{
Name: team.Name,
Description: team.Description,
Maintainers: team.Maintainers,
RepoNames: team.RepoNames,
Privacy: team.Privacy,
LDAPDN: team.LDAPDN,
Name: team.Name,
Description: team.Description,
Maintainers: team.Maintainers,
RepoNames: team.RepoNames,
NotificationSetting: team.NotificationSetting,
Privacy: team.Privacy,
LDAPDN: team.LDAPDN,
}
}

Expand Down
8 changes: 4 additions & 4 deletions github/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func TestTeamsService_EditTeamByID(t *testing.T) {
func TestTeamsService_EditTeamByID_RemoveParent(t *testing.T) {
client, mux, _ := setup(t)

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

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

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

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

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

if want := `{"name":"n","parent_team_id":null,"privacy":"closed"}` + "\n"; body != want {
if want := `{"name":"n","parent_team_id":null,"notification_setting":"notifications_disabled","privacy":"closed"}` + "\n"; body != want {
t.Errorf("Teams.EditTeam body = %+v, want %+v", body, want)
}
}
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载