From 53ef4d120b119f03305b34d680a0c52c100b81ef Mon Sep 17 00:00:00 2001 From: Scott Bishel Date: Tue, 23 Jun 2020 10:47:48 -0600 Subject: [PATCH] MM-25544:Update error message for length violations (#14853) * update error message for length violations * fix unit test Co-authored-by: Mattermod --- i18n/en.json | 4 ++++ model/group.go | 2 +- store/storetest/group_store.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 07204f54a6..e38220c5ea 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -5518,6 +5518,10 @@ "id": "model.group.name.invalid_chars.app_error", "translation": "invalid characters in the name property for group" }, + { + "id": "model.group.name.invalid_length.app_error", + "translation": "Name must be 1 to 64 lowercase alphanumeric characters." + }, { "id": "model.group.remote_id.app_error", "translation": "invalid remote id property for group." diff --git a/model/group.go b/model/group.go index d713582622..2eda118467 100644 --- a/model/group.go +++ b/model/group.go @@ -186,7 +186,7 @@ func (group *Group) IsValidName() *AppError { } } else { if l := len(*group.Name); l == 0 || l > GroupNameMaxLength { - return NewAppError("Group.IsValidName", "model.group.name.app_error", map[string]interface{}{"GroupNameMaxLength": GroupNameMaxLength}, "", http.StatusBadRequest) + return NewAppError("Group.IsValidName", "model.group.name.invalid_length.app_error", map[string]interface{}{"GroupNameMaxLength": GroupNameMaxLength}, "", http.StatusBadRequest) } if !validGroupnameChars.MatchString(*group.Name) { diff --git a/store/storetest/group_store.go b/store/storetest/group_store.go index eae4f95c19..a27968bdb6 100644 --- a/store/storetest/group_store.go +++ b/store/storetest/group_store.go @@ -148,7 +148,7 @@ func testGroupStoreCreate(t *testing.T, ss store.Store) { require.Nil(t, g5.IsValidForCreate()) g5.Name = model.NewString(*g5.Name + "x") - require.Equal(t, g5.IsValidForCreate().Id, "model.group.name.app_error") + require.Equal(t, g5.IsValidForCreate().Id, "model.group.name.invalid_length.app_error") g5.Name = model.NewString(model.NewId()) require.Nil(t, g5.IsValidForCreate())