diff --git a/server/config/client.go b/server/config/client.go index 73e9ca5bdd..59366327c3 100644 --- a/server/config/client.go +++ b/server/config/client.go @@ -25,6 +25,7 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li props["EnableJoinLeaveMessageByDefault"] = strconv.FormatBool(*c.TeamSettings.EnableJoinLeaveMessageByDefault) props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation) + props["EnableDesktopLandingPage"] = strconv.FormatBool(*c.ServiceSettings.EnableDesktopLandingPage) props["EnableOAuthServiceProvider"] = strconv.FormatBool(*c.ServiceSettings.EnableOAuthServiceProvider) props["GoogleDeveloperKey"] = *c.ServiceSettings.GoogleDeveloperKey props["EnableIncomingWebhooks"] = strconv.FormatBool(*c.ServiceSettings.EnableIncomingWebhooks) @@ -244,6 +245,7 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m props["ServiceEnvironment"] = model.GetServiceEnvironment() props["EnableBotAccountCreation"] = strconv.FormatBool(*c.ServiceSettings.EnableBotAccountCreation) + props["EnableDesktopLandingPage"] = strconv.FormatBool(*c.ServiceSettings.EnableDesktopLandingPage) props["EnableFile"] = strconv.FormatBool(*c.LogSettings.EnableFile) props["FileLevel"] = *c.LogSettings.FileLevel diff --git a/server/public/model/config.go b/server/public/model/config.go index 0cdd7e46a3..dba1eee5e3 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -387,6 +387,7 @@ type ServiceSettings struct { EnableAPITeamDeletion *bool EnableAPITriggerAdminNotifications *bool EnableAPIUserDeletion *bool + EnableDesktopLandingPage *bool ExperimentalEnableHardenedMode *bool `access:"experimental_features"` ExperimentalStrictCSRFEnforcement *bool `access:"experimental_features,write_restrictable,cloud_restrictable"` EnableEmailInvitations *bool `access:"authentication_signup"` @@ -825,6 +826,10 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) { s.EnableBotAccountCreation = NewPointer(false) } + if s.EnableDesktopLandingPage == nil { + s.EnableDesktopLandingPage = NewPointer(true) + } + if s.EnableSVGs == nil { if isUpdate { s.EnableSVGs = NewPointer(true) diff --git a/webapp/channels/src/components/admin_console/admin_definition.tsx b/webapp/channels/src/components/admin_console/admin_definition.tsx index fddd626531..65b0114362 100644 --- a/webapp/channels/src/components/admin_console/admin_definition.tsx +++ b/webapp/channels/src/components/admin_console/admin_definition.tsx @@ -2024,6 +2024,13 @@ const AdminDefinition: AdminDefinitionType = { isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.SITE.CUSTOMIZATION)), isHidden: it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'), }, + { + type: 'bool', + key: 'ServiceSettings.EnableDesktopLandingPage', + label: defineMessage({id: 'admin.customization.enableDesktopLandingPageTitle', defaultMessage: 'Enable Desktop App Landing Page:'}), + help_text: defineMessage({id: 'admin.customization.enableDesktopLandingPageDesc', defaultMessage: 'Whether or not to prompt a user to use the Desktop App when they first use Mattermost.'}), + isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.SITE.CUSTOMIZATION)), + }, ], }, }, diff --git a/webapp/channels/src/components/root/index.ts b/webapp/channels/src/components/root/index.ts index 8060038e32..80968829e5 100644 --- a/webapp/channels/src/components/root/index.ts +++ b/webapp/channels/src/components/root/index.ts @@ -61,6 +61,7 @@ function mapStateToProps(state: GlobalState) { iosDownloadLink: config.IosAppDownloadLink, androidDownloadLink: config.AndroidAppDownloadLink, appDownloadLink: config.AppDownloadLink, + enableDesktopLandingPage: config.EnableDesktopLandingPage === 'true', permalinkRedirectTeamName: permalinkRedirectTeam ? permalinkRedirectTeam.name : '', showTermsOfService, plugins, diff --git a/webapp/channels/src/components/root/root.test.tsx b/webapp/channels/src/components/root/root.test.tsx index 0ce71ab3f9..9616dc308d 100644 --- a/webapp/channels/src/components/root/root.test.tsx +++ b/webapp/channels/src/components/root/root.test.tsx @@ -93,6 +93,7 @@ describe('components/Root', () => { rhsState: null, shouldShowAppBar: false, isCloud: false, + enableDesktopLandingPage: true, actions: { loadConfigAndMe: jest.fn().mockImplementation(() => { return Promise.resolve({ @@ -356,6 +357,19 @@ describe('components/Root', () => { expect(props.history.push).not.toHaveBeenCalled(); }); }); + + test('should not show when disabled', async () => { + const props = { + ...landingProps, + enableDesktopLandingPage: false, + }; + + renderWithContext(); + + await waitFor(() => { + expect(props.history.push).not.toHaveBeenCalled(); + }); + }); }); }); diff --git a/webapp/channels/src/components/root/root.tsx b/webapp/channels/src/components/root/root.tsx index 804fff735c..6bba0340a2 100644 --- a/webapp/channels/src/components/root/root.tsx +++ b/webapp/channels/src/components/root/root.tsx @@ -193,6 +193,11 @@ export default class Root extends React.PureComponent { }; private showLandingPageIfNecessary = () => { + // Only show Landing Page if enabled + if (!this.props.enableDesktopLandingPage) { + return; + } + // We have nothing to redirect to if we're already on Desktop App // Chromebook has no Desktop App to switch to if (isDesktopApp() || isChromebook()) { diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 9617705e36..8386b1f190 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -647,6 +647,8 @@ "admin.customization.customUrlSchemesPlaceholder": "E.g.: \"git,smtp\"", "admin.customization.enableCustomEmojiDesc": "Enable users to create custom emoji for use in messages. When enabled, custom emoji settings can be accessed in Channels through the emoji picker.", "admin.customization.enableCustomEmojiTitle": "Enable Custom Emoji:", + "admin.customization.enableDesktopLandingPageDesc": "Whether or not to prompt a user to use the Desktop App when they first use Mattermost.", + "admin.customization.enableDesktopLandingPageTitle": "Enable Desktop App Landing Page:", "admin.customization.enableEmojiPickerDesc": "The emoji picker allows users to select emoji to add as reactions or use in messages. Enabling the emoji picker with a large number of custom emoji may slow down performance.", "admin.customization.enableEmojiPickerTitle": "Enable Emoji Picker:", "admin.customization.enableGifPickerDesc": "Allows users to select GIFs from the emoji picker.", diff --git a/webapp/platform/types/src/config.ts b/webapp/platform/types/src/config.ts index 4e3f7113fe..67ebe0f6bf 100644 --- a/webapp/platform/types/src/config.ts +++ b/webapp/platform/types/src/config.ts @@ -64,6 +64,7 @@ export type ClientConfig = { EnableCustomTermsOfService: string; EnableDeveloper: string; EnableDiagnostics: string; + EnableDesktopLandingPage: 'true' | 'false'; EnableEmailBatching: string; EnableEmailInvitations: string; EnableEmojiPicker: string;