MM-50952 RFQA can save notifications

This commit is contained in:
Nathaniel Allred
2023-03-29 07:57:52 -05:00
committed by GitHub
parent 5267dfdcc6
commit c78d6d47ac
2 changed files with 10 additions and 5 deletions

View File

@@ -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,

View File

@@ -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;