From 17edb6726b7e6388d0ac409bf39ab597f29cf46d Mon Sep 17 00:00:00 2001 From: Vishal Date: Fri, 15 Mar 2024 10:05:47 +0530 Subject: [PATCH] allow fetch request without a config save (#26046) Co-authored-by: Mattermost Build --- .../channels/src/components/admin_console/admin_definition.tsx | 1 + .../src/components/admin_console/schema_admin_settings.tsx | 2 +- webapp/channels/src/components/admin_console/types.ts | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/channels/src/components/admin_console/admin_definition.tsx b/webapp/channels/src/components/admin_console/admin_definition.tsx index f013517ef0..fdf8198483 100644 --- a/webapp/channels/src/components/admin_console/admin_definition.tsx +++ b/webapp/channels/src/components/admin_console/admin_definition.tsx @@ -4018,6 +4018,7 @@ const AdminDefinition: AdminDefinitionType = { it.stateEquals('SamlSettings.IdpMetadataURL', ''), ), sourceUrlKey: 'SamlSettings.IdpMetadataURL', + skipSaveNeeded: true, }, { type: 'text', diff --git a/webapp/channels/src/components/admin_console/schema_admin_settings.tsx b/webapp/channels/src/components/admin_console/schema_admin_settings.tsx index 1d5fa4aed2..0b09ef8567 100644 --- a/webapp/channels/src/components/admin_console/schema_admin_settings.tsx +++ b/webapp/channels/src/components/admin_console/schema_admin_settings.tsx @@ -446,7 +446,7 @@ export class SchemaAdminSettings extends React.PureComponent { } const handleRequestAction = (success: () => void, error: (error: {message: string}) => void) => { - if (this.state.saveNeeded !== false) { + if (!setting.skipSaveNeeded && this.state.saveNeeded !== false) { error({ message: this.props.intl.formatMessage({id: 'admin_settings.save_unsaved_changes', defaultMessage: 'Please save unsaved changes first'}), }); diff --git a/webapp/channels/src/components/admin_console/types.ts b/webapp/channels/src/components/admin_console/types.ts index c5fdf1207c..cd8e048f11 100644 --- a/webapp/channels/src/components/admin_console/types.ts +++ b/webapp/channels/src/components/admin_console/types.ts @@ -124,6 +124,7 @@ type AdminDefinitionSettingButton = AdminDefinitionSettingBase & { error_message: string | MessageDescriptor; success_message?: string | MessageDescriptor; sourceUrlKey?: string; + skipSaveNeeded?: boolean; } type AdminDefinitionSettingUsername = AdminDefinitionSettingBase & {