diff --git a/server/channels/app/custom_profile_attributes.go b/server/channels/app/custom_profile_attributes.go index be486e0cb27..3c290fe6215 100644 --- a/server/channels/app/custom_profile_attributes.go +++ b/server/channels/app/custom_profile_attributes.go @@ -95,7 +95,7 @@ func (a *App) CreateCPAField(field *model.CPAField) (*model.PropertyField, *mode field.GroupID = groupID - if appErr := field.Sanitize(); appErr != nil { + if appErr := field.SanitizeAndValidate(); appErr != nil { return nil, appErr } @@ -133,7 +133,7 @@ func (a *App) PatchCPAField(fieldID string, patch *model.PropertyFieldPatch) (*m return nil, model.NewAppError("UpdateCPAField", "app.custom_profile_attributes.property_field_conversion.app_error", nil, "", http.StatusInternalServerError).Wrap(err) } - if appErr := cpaField.Sanitize(); appErr != nil { + if appErr := cpaField.SanitizeAndValidate(); appErr != nil { return nil, appErr } diff --git a/server/public/model/custom_profile_attributes.go b/server/public/model/custom_profile_attributes.go index 582debafa51..8b7253d7c85 100644 --- a/server/public/model/custom_profile_attributes.go +++ b/server/public/model/custom_profile_attributes.go @@ -131,7 +131,7 @@ func (c *CPAField) ToPropertyField() *PropertyField { return &pf } -func (c *CPAField) Sanitize() *AppError { +func (c *CPAField) SanitizeAndValidate() *AppError { switch c.Type { case PropertyFieldTypeText: if valueType := strings.TrimSpace(c.Attrs.ValueType); valueType != "" { diff --git a/server/public/model/custom_profile_attributes_test.go b/server/public/model/custom_profile_attributes_test.go index 5f2ce3e5864..ed310471a6b 100644 --- a/server/public/model/custom_profile_attributes_test.go +++ b/server/public/model/custom_profile_attributes_test.go @@ -289,7 +289,7 @@ func TestCustomProfileAttributeSelectOptionIsValid(t *testing.T) { } } -func TestCPAField_Sanitize(t *testing.T) { +func TestCPAField_SanitizeAndValidate(t *testing.T) { tests := []struct { name string field *CPAField @@ -446,7 +446,7 @@ func TestCPAField_Sanitize(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := tt.field.Sanitize() + err := tt.field.SanitizeAndValidate() if tt.expectError { require.NotNil(t, err) require.Equal(t, tt.errorId, err.Id)