diff --git a/openapi/tests/user/team_config_robot_test.go b/openapi/tests/user/team_config_robot_test.go index f1492831..a9f5ae6a 100644 --- a/openapi/tests/user/team_config_robot_test.go +++ b/openapi/tests/user/team_config_robot_test.go @@ -105,8 +105,6 @@ func TestGetTeamConfigPublic(t *testing.T) { assert.Equal(t, originalConfig.Role, publicConfig.Role, "Role should be preserved") assert.Equal(t, originalConfig.Roles, publicConfig.Roles, "Roles should be preserved") assert.Equal(t, originalConfig.Invite, publicConfig.Invite, "Invite config should be preserved") - assert.Equal(t, originalConfig.Uploader, publicConfig.Uploader, "Uploader should be preserved (public field)") - assert.Equal(t, originalConfig.AvatarAgent, publicConfig.AvatarAgent, "AvatarAgent should be preserved (public field)") // Test robot configuration if originalConfig.Robot != nil { diff --git a/openapi/tests/user/team_config_test.go b/openapi/tests/user/team_config_test.go index b55f283b..0f745d2a 100644 --- a/openapi/tests/user/team_config_test.go +++ b/openapi/tests/user/team_config_test.go @@ -51,19 +51,6 @@ func TestTeamConfigStructure(t *testing.T) { // Verify team config structure is valid assert.IsType(t, &user.TeamConfig{}, teamConfig, "Should return correct team config type") - // Test uploader field (public field) - if teamConfig.Uploader != "" { - t.Logf("Uploader configured: %s", teamConfig.Uploader) - assert.NotEmpty(t, teamConfig.Uploader, "Uploader should not be empty if set") - } - - // Test avatar_agent field (public field, optional) - if teamConfig.AvatarAgent != "" { - t.Logf("Avatar agent configured: %s", teamConfig.AvatarAgent) - } else { - t.Log("Avatar agent not configured (optional field)") - } - // Test roles configuration if teamConfig.Roles != nil { assert.IsType(t, []*user.TeamRole{}, teamConfig.Roles, "Roles should be slice of TeamRole pointers") @@ -176,19 +163,6 @@ func TestTeamConfigAPI(t *testing.T) { // Verify team config structure assert.IsType(t, &user.TeamConfig{}, &teamConfig, "Should return correct team config type") - // Test uploader field (public field) - if teamConfig.Uploader != "" { - t.Logf("API returned uploader: %s", teamConfig.Uploader) - assert.NotEmpty(t, teamConfig.Uploader, "Uploader should not be empty if set") - } - - // Test avatar_agent field (public field, optional) - if teamConfig.AvatarAgent != "" { - t.Logf("API returned avatar_agent: %s", teamConfig.AvatarAgent) - } else { - t.Log("API returned no avatar_agent (optional field)") - } - // Test roles if present if teamConfig.Roles != nil { assert.IsType(t, []*user.TeamRole{}, teamConfig.Roles, "Roles should be slice of TeamRole pointers") diff --git a/openapi/user/config.go b/openapi/user/config.go index 4770252f..162437e8 100644 --- a/openapi/user/config.go +++ b/openapi/user/config.go @@ -344,12 +344,10 @@ func GetTeamConfigPublic(locale string) *TeamConfig { // Create a deep copy of the config to avoid modifying the original publicConfig := &TeamConfig{ - Type: originalConfig.Type, - Role: originalConfig.Role, - Roles: originalConfig.Roles, // Shallow copy is OK for roles (read-only) - Invite: originalConfig.Invite, // Shallow copy is OK for invite config (read-only) - Uploader: originalConfig.Uploader, // Public information - AvatarAgent: originalConfig.AvatarAgent, // Public information + Type: originalConfig.Type, + Role: originalConfig.Role, + Roles: originalConfig.Roles, // Shallow copy is OK for roles (read-only) + Invite: originalConfig.Invite, // Shallow copy is OK for invite config (read-only) } // Handle robot config - create a copy without sensitive fields diff --git a/openapi/user/types.go b/openapi/user/types.go index d34594c5..ae88e03f 100644 --- a/openapi/user/types.go +++ b/openapi/user/types.go @@ -680,13 +680,11 @@ type RobotDefaults struct { // TeamConfig represents the team configuration loaded from DSL files type TeamConfig struct { - Roles []*TeamRole `json:"roles,omitempty"` - Robot *RobotConfig `json:"robot,omitempty"` - Invite *InviteConfig `json:"invite,omitempty"` - Type string `json:"type,omitempty"` // Default subscription type for new teams - Role string `json:"role,omitempty"` // Default user role for team creator - Uploader string `json:"uploader,omitempty"` // Uploader for avatar and attachments (default: __yao.attachment) - AvatarAgent string `json:"avatar_agent,omitempty"` // Agent ID for avatar generation (optional) + Roles []*TeamRole `json:"roles,omitempty"` + Robot *RobotConfig `json:"robot,omitempty"` + Invite *InviteConfig `json:"invite,omitempty"` + Type string `json:"type,omitempty"` // Default subscription type for new teams + Role string `json:"role,omitempty"` // Default user role for team creator } // TeamRole represents a team role configuration