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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
098873b58f
Коммит
54df69e57a
@@ -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()
|
||||
|
||||
Ссылка в новой задаче
Block a user