MM-50952 RFQA can save notifications

Этот коммит содержится в:
Nathaniel Allred
2023-03-29 07:57:52 -05:00
коммит произвёл GitHub
родитель 5267dfdcc6
Коммит c78d6d47ac
2 изменённых файлов: 10 добавлений и 5 удалений

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

@@ -2497,11 +2497,7 @@ const AdminDefinition = {
it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.SITE.NOTIFICATIONS)),
it.stateIsFalse('EmailSettings.SendEmailNotifications'),
),
// MM-50952
// If the setting is hidden, then it is not being set in state so there is
// nothing to validate, and validation would fail anyways and prevent saving
validate: it.configIsFalse('ExperimentalSettings', 'RestrictSystemAdmin') && validators.isRequired(t('admin.environment.notifications.feedbackEmail.required'), '"Notification From Address" is required'),
validate: validators.isRequired(t('admin.environment.notifications.feedbackEmail.required'), '"Notification From Address" is required'),
},
{
type: Constants.SettingsTypes.TYPE_TEXT,

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

@@ -1126,6 +1126,15 @@ export default class SchemaAdminSettings extends React.PureComponent {
}
if (setting.validate) {
if (setting.isHidden?.(this.props.config)) {
// MM-50952
// If the setting is hidden, then it is not being set in state so there is
// nothing to validate, and validation would fail anyways and prevent saving
// In practice, this only happens in custom cloud setup environments like RFQA
// where it sets things in the config file directly instead of in the environment
// (like cloud Mattermost does)
continue;
}
const result = setting.validate(this.state[setting.key]);
if (!result.isValid()) {
return false;