MM-53107 Add setting to limit the max number of markdown nodes (#24414)
* MM-53107 Add setting to limit the max number of markdown nodes * Add extra validation for a couple config fields * Add new setting to telemetry
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
47b51ff696
Коммит
f2fcf3d839
@@ -3149,7 +3149,8 @@ func (s *MessageExportSettings) SetDefaults() {
|
||||
}
|
||||
|
||||
type DisplaySettings struct {
|
||||
CustomURLSchemes []string `access:"site_customization"`
|
||||
CustomURLSchemes []string `access:"site_posts"`
|
||||
MaxMarkdownNodes *int `access:"site_posts"`
|
||||
ExperimentalTimezone *bool `access:"experimental_features"`
|
||||
}
|
||||
|
||||
@@ -3159,6 +3160,10 @@ func (s *DisplaySettings) SetDefaults() {
|
||||
s.CustomURLSchemes = customURLSchemes
|
||||
}
|
||||
|
||||
if s.MaxMarkdownNodes == nil {
|
||||
s.MaxMarkdownNodes = NewInt(0)
|
||||
}
|
||||
|
||||
if s.ExperimentalTimezone == nil {
|
||||
s.ExperimentalTimezone = NewBool(true)
|
||||
}
|
||||
@@ -3502,6 +3507,10 @@ func (o *Config) IsValid() *AppError {
|
||||
return appErr
|
||||
}
|
||||
|
||||
if appErr := o.ExperimentalSettings.isValid(); appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
|
||||
if appErr := o.SqlSettings.isValid(); appErr != nil {
|
||||
return appErr
|
||||
}
|
||||
@@ -3577,6 +3586,10 @@ func (s *TeamSettings) isValid() *AppError {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.max_channels.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if *s.UserStatusAwayTimeout <= 0 {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.user_status_away_timeout.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if *s.MaxNotificationsPerChannel <= 0 {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.max_notify_per_channel.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
@@ -3596,6 +3609,14 @@ func (s *TeamSettings) isValid() *AppError {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ExperimentalSettings) isValid() *AppError {
|
||||
if *s.LinkMetadataTimeoutMilliseconds <= 0 {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.link_metadata_timeout.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SqlSettings) isValid() *AppError {
|
||||
if *s.AtRestEncryptKey != "" && len(*s.AtRestEncryptKey) < 32 {
|
||||
return NewAppError("Config.IsValid", "model.config.is_valid.encrypt_sql.app_error", nil, "", http.StatusBadRequest)
|
||||
|
||||
Ссылка в новой задаче
Block a user