From 54df69e57ab0ca5fc1102b4e1ecca95e2c189b9b Mon Sep 17 00:00:00 2001 From: Christopher Poile Date: Mon, 12 Sep 2022 14:35:33 -0400 Subject: [PATCH] MM-46947 - Fix: Manifest parsing won't allow placeholders for custom pluginSettingType (#21004) * allow custom pluginSettingTypes to have a placeholder * i18n * lock it down with a test case Co-authored-by: Mattermod --- model/manifest.go | 5 +++-- model/manifest_test.go | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/model/manifest.go b/model/manifest.go index 9b1551e921..9c5047a887 100644 --- a/model/manifest.go +++ b/model/manifest.go @@ -364,8 +364,9 @@ func (s *PluginSetting) isValid() error { pluginSettingType == Text || pluginSettingType == LongText || pluginSettingType == Number || - pluginSettingType == Username) { - return errors.New("should not set Placeholder for setting type not in text, generated or username") + pluginSettingType == Username || + pluginSettingType == Custom) { + return errors.New("should not set Placeholder for setting type not in text, generated, number, username, or custom") } if s.Options != nil { diff --git a/model/manifest_test.go b/model/manifest_test.go index de93569b53..8f42ab5f4b 100644 --- a/model/manifest_test.go +++ b/model/manifest_test.go @@ -184,6 +184,13 @@ func TestSettingIsValid(t *testing.T) { }, false, }, + "Placeholder is allowed for custom settings": { + PluginSetting{ + Type: "custom", + Placeholder: "some Text", + }, + false, + }, } { t.Run(name, func(t *testing.T) { err := test.Setting.isValid()