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 <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Christopher Poile
2022-09-12 14:35:33 -04:00
коммит произвёл GitHub
родитель 098873b58f
Коммит 54df69e57a
2 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@@ -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 {

Просмотреть файл

@@ -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()