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 == Text ||
|
||||||
pluginSettingType == LongText ||
|
pluginSettingType == LongText ||
|
||||||
pluginSettingType == Number ||
|
pluginSettingType == Number ||
|
||||||
pluginSettingType == Username) {
|
pluginSettingType == Username ||
|
||||||
return errors.New("should not set Placeholder for setting type not in text, generated or 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 {
|
if s.Options != nil {
|
||||||
|
|||||||
@@ -184,6 +184,13 @@ func TestSettingIsValid(t *testing.T) {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
},
|
},
|
||||||
|
"Placeholder is allowed for custom settings": {
|
||||||
|
PluginSetting{
|
||||||
|
Type: "custom",
|
||||||
|
Placeholder: "some Text",
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
err := test.Setting.isValid()
|
err := test.Setting.isValid()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user