From c78d6d47acda687ad059440d73f47972a1bf0960 Mon Sep 17 00:00:00 2001 From: Nathaniel Allred Date: Wed, 29 Mar 2023 07:57:52 -0500 Subject: [PATCH] MM-50952 RFQA can save notifications --- .../src/components/admin_console/admin_definition.jsx | 6 +----- .../components/admin_console/schema_admin_settings.jsx | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/webapp/channels/src/components/admin_console/admin_definition.jsx b/webapp/channels/src/components/admin_console/admin_definition.jsx index 5eab5ed08f..387b13825b 100644 --- a/webapp/channels/src/components/admin_console/admin_definition.jsx +++ b/webapp/channels/src/components/admin_console/admin_definition.jsx @@ -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, diff --git a/webapp/channels/src/components/admin_console/schema_admin_settings.jsx b/webapp/channels/src/components/admin_console/schema_admin_settings.jsx index 7faa9825fc..665bc85d25 100644 --- a/webapp/channels/src/components/admin_console/schema_admin_settings.jsx +++ b/webapp/channels/src/components/admin_console/schema_admin_settings.jsx @@ -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;