Allow placeholder for types number and longtext (#13809)

Этот коммит содержится в:
Ben Schumacher
2020-02-05 10:46:58 +01:00
коммит произвёл GitHub
родитель 435d43049f
Коммит 57717a23af
2 изменённых файлов: 80 добавлений и 32 удалений

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

@@ -76,7 +76,7 @@ type PluginSetting struct {
// The help text to display alongside the "Regenerate" button for settings of the "generated" type.
RegenerateHelpText string `json:"regenerate_help_text,omitempty" yaml:"regenerate_help_text,omitempty"`
// The placeholder to display for "text", "generated" and "username" types when blank.
// The placeholder to display for "generated", "text", "longtext", "number" and "username" types when blank.
Placeholder string `json:"placeholder" yaml:"placeholder"`
// The default value of the setting.
@@ -386,7 +386,11 @@ func (s *PluginSetting) isValid() error {
return errors.New("should not set RegenerateHelpText for setting type that is not generated")
}
if s.Placeholder != "" && !(pluginSettingType == Text || pluginSettingType == Generated || pluginSettingType == Username) {
if s.Placeholder != "" && !(pluginSettingType == Generated ||
pluginSettingType == Text ||
pluginSettingType == LongText ||
pluginSettingType == Number ||
pluginSettingType == Username) {
return errors.New("should not set Placeholder for setting type not in text, generated or username")
}