MM-50347 Make desktop app landing page optional (#28421)

* fix: Make desktop app landing page optional

* Update i18n strings

* Fix linting and unit test

---------

Co-authored-by: Kiran <kiran@krinati.co>
Этот коммит содержится в:
Harrison Healey
2024-10-02 15:48:54 -04:00
коммит произвёл GitHub
родитель 0048723ccd
Коммит 394f625bcb
8 изменённых файлов: 37 добавлений и 0 удалений

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

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

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

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

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

@@ -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)),
},
],
},
},

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

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

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

@@ -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(<Root {...props}/>);
await waitFor(() => {
expect(props.history.push).not.toHaveBeenCalled();
});
});
});
});

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

@@ -193,6 +193,11 @@ export default class Root extends React.PureComponent<Props, State> {
};
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()) {

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

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

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

@@ -64,6 +64,7 @@ export type ClientConfig = {
EnableCustomTermsOfService: string;
EnableDeveloper: string;
EnableDiagnostics: string;
EnableDesktopLandingPage: 'true' | 'false';
EnableEmailBatching: string;
EnableEmailInvitations: string;
EnableEmojiPicker: string;