diff --git a/webapp/channels/src/actions/views/root.ts b/webapp/channels/src/actions/views/root.ts index 5a767359d2..925eaf9c2c 100644 --- a/webapp/channels/src/actions/views/root.ts +++ b/webapp/channels/src/actions/views/root.ts @@ -1,7 +1,10 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. +import type {ServerError} from '@mattermost/types/errors'; + import {getClientConfig, getLicenseConfig} from 'mattermost-redux/actions/general'; +import {redirectToErrorPageIfNecessary} from 'mattermost-redux/actions/helpers'; import {loadMe} from 'mattermost-redux/actions/users'; import {Client4} from 'mattermost-redux/client'; import type {ActionFuncAsync, ThunkActionFunc} from 'mattermost-redux/types/actions'; @@ -12,6 +15,7 @@ import {checkIKTokenIsExpired, refreshIKToken} from 'components/login/utils'; import {ActionTypes} from 'utils/constants'; import {isDesktopApp} from 'utils/user_agent'; +import * as UserAgent from 'utils/user_agent'; import en from 'i18n/en.json'; @@ -39,6 +43,19 @@ export function loadConfigAndMe(): ActionFuncAsync { dispatch(getLicenseConfig()), ]); + let redirect = true; + if (!UserAgent.isMacApp() || !UserAgent.isNotMacMas()) { + redirect = false; + } + + if (redirect) { + const forceMigrationError: ServerError = { + message: 'Maintenance mode', + status_code: 1, + }; + redirectToErrorPageIfNecessary(forceMigrationError); + } + let isMeLoaded = false; // if (document.cookie.includes('MMUSERID=')) { @@ -118,3 +135,4 @@ export function registerCustomPostRenderer(type: string, component: any, id: str return {data: true}; }; } + diff --git a/webapp/channels/src/components/error_page/assets/SvgIlluErrorMigration.tsx b/webapp/channels/src/components/error_page/assets/SvgIlluErrorMigration.tsx new file mode 100644 index 0000000000..42bc37070f --- /dev/null +++ b/webapp/channels/src/components/error_page/assets/SvgIlluErrorMigration.tsx @@ -0,0 +1,139 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import React from 'react'; + +const SvgIlluMigration = (props) => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default SvgIlluMigration; diff --git a/webapp/channels/src/components/error_page/error_message.tsx b/webapp/channels/src/components/error_page/error_message.tsx index 6acbebbc0f..3c7807bc51 100644 --- a/webapp/channels/src/components/error_page/error_message.tsx +++ b/webapp/channels/src/components/error_page/error_message.tsx @@ -222,6 +222,16 @@ const ErrorMessage: React.FC = ({type, message, service, isGuest}: Props)

); break; + case ErrorPageTypes.FORCE_MIGRATION: + errorMessage = ( +

+ +

+ ); + break; case ErrorPageTypes.PAGE_NOT_FOUND: default: errorMessage = ( diff --git a/webapp/channels/src/components/error_page/error_page.tsx b/webapp/channels/src/components/error_page/error_page.tsx index 19342c3650..c535a84d3a 100644 --- a/webapp/channels/src/components/error_page/error_page.tsx +++ b/webapp/channels/src/components/error_page/error_page.tsx @@ -8,15 +8,16 @@ import {Link} from 'react-router-dom'; import * as GlobalActions from 'actions/global_actions'; +import {ErrorPageTypes} from 'utils/constants'; + import kSuite from 'images/ik/kSuite.svg'; import MattermostLogoSvg from 'images/logo.svg'; import loaderkChat from 'images/logo_compact.png'; import NoTeamIcon from 'images/no_team_icon.png'; -import {ErrorPageTypes, Constants} from 'utils/constants'; -import {isDesktopApp} from 'utils/user_agent'; import SvgIlluErrorBlocked from './assets/SvgIlluErrorBlocked'; import SvgIlluErrorMaintenance from './assets/SvgIlluErrorMaintenance'; +import SvgIlluMigration from './assets/SvgIlluErrorMigration'; import SvgIlluErrorQuestion from './assets/SvgIlluErrorQuestion'; import ErrorMessage from './error_message'; import ErrorTitle from './error_title'; @@ -77,6 +78,10 @@ export default class ErrorPage extends React.PureComponent { } }; + const goToAppStore = () => { + window.open('https://apps.apple.com/app/infomaniak-kchat/id6443845553', '_blank'); + }; + const goToKsuite = () => { if (window) { window.open('https://infomaniak.com/ksuite', '_blank'); @@ -104,6 +109,7 @@ export default class ErrorPage extends React.PureComponent { let backButton; let secondaryButton; let illustration: JSX.Element | null = ; + const illustrationMigration: JSX.Element | null = ; let fullscreenIllustration; if (type === ErrorPageTypes.PERMALINK_NOT_FOUND && returnTo) { backButton = ( @@ -285,6 +291,20 @@ export default class ErrorPage extends React.PureComponent { /> ); + } else if (type === ErrorPageTypes.FORCE_MIGRATION) { + illustration = illustrationMigration; + backButton = ( + + + + ); } else { backButton = ( = ({type, title, groupName}: Props) => { /> ); break; + case ErrorPageTypes.FORCE_MIGRATION: + errorTitle = ( + + ); + break; case ErrorPageTypes.PAGE_NOT_FOUND: default: errorTitle = ( diff --git a/webapp/channels/src/i18n/de.json b/webapp/channels/src/i18n/de.json index 3c13f10295..8e5b64137d 100644 --- a/webapp/channels/src/i18n/de.json +++ b/webapp/channels/src/i18n/de.json @@ -3536,6 +3536,9 @@ "error.channel_not_found.message": "Der Kanal, den du anforderst ist privat oder existiert nicht. Bitte kontaktiere einen Administrator, um dem Kanal hinzugefügt zu werden.", "error.channel_not_found.message_guest": "Dein Gastkonto ist keinem Kanal zugeordnet. Bitte kontaktiere einen Administrator.", "error.channel_not_found.title": "Kanal nicht gefunden", + "error.force_migration.message": "Ihre Version der Anwendung wird nicht mehr unterstützt. Bitte laden Sie die neue Version herunter und installieren Sie sie, um von den neuesten Verbesserungen zu profitieren.", + "error.force_migration.title": "Laden Sie die neue Version der kChat-Anwendung herunter", + "error.generic.dl_link": "Laden Sie die neue Version herunter", "error.generic.link": "Zurück zu {siteName}", "error.generic.link_ksuite": "Entdecke kSuite", "error.generic.link_login": "Zurück zur Anmeldeseite", diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 53005f17ae..5b4be6329d 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -3617,6 +3617,9 @@ "error.channel_not_found.title": "Channel Not Found", "error.channelNotFound.guest_link": "Back", "error.channelNotFound.link": "Back to {defaultChannelName}", + "error.force_migration.message": "Your version of the application is no longer supported. Please download and install the new version to benefit from the latest improvements.", + "error.force_migration.title": "Download the new version of the kChat application", + "error.generic.dl_link": "Download the new version", "error.generic.link": "Back to {siteName}", "error.generic.link_ksuite": "Discover kSuite", "error.generic.link_login": "Back to Login Page", diff --git a/webapp/channels/src/i18n/es.json b/webapp/channels/src/i18n/es.json index ece6235fcc..dc0fab5ed2 100644 --- a/webapp/channels/src/i18n/es.json +++ b/webapp/channels/src/i18n/es.json @@ -3193,6 +3193,9 @@ "error.channel_not_found.message": "El canal que estás solicitando es privado o no existe. Por favor contacta a un Administrador para ser agregado al canal.", "error.channel_not_found.message_guest": "Tu cuenta de huésped no tiene canales asignados. Por favor contacta a un administrador.", "error.channel_not_found.title": "Canal no encontrado", + "error.force_migration.message": "Su versión de la aplicación ya no es compatible. Por favor, descargue e instale la nueva versión para beneficiarse de las últimas mejoras.", + "error.force_migration.title": "Descargar la nueva versión de la aplicación kChat", + "error.generic.dl_link": "Descargar la nueva versión", "error.generic.link": "Volver a {siteName}", "error.generic.link_ksuite": "Descubra kSuite", "error.generic.link_login": "Volver a la página de inicio de sesión", diff --git a/webapp/channels/src/i18n/fr.json b/webapp/channels/src/i18n/fr.json index a59fda59dd..15d216d04c 100644 --- a/webapp/channels/src/i18n/fr.json +++ b/webapp/channels/src/i18n/fr.json @@ -3162,6 +3162,9 @@ "error.channel_not_found.message": "Le canal que vous avez demandé est privé ou n'existe pas. Veuillez contacter un administrateur pour être rajouté à ce canal le cas échéant.", "error.channel_not_found.message_guest": "Votre compte utilisateur invité n'a pas de canal assigné. Veuillez contacter un administrateur.", "error.channel_not_found.title": "Canal introuvable", + "error.force_migration.message": "Votre version de l’application n’est plus supportée. Veuillez télécharger la nouvelle version et l’installer pour bénéficier des dernières améliorations.", + "error.force_migration.title": "Télécharger la nouvelle version de l’application kChat", + "error.generic.dl_link": "Télécharger la nouvelle version", "error.generic.link": "Retour à {siteName}", "error.generic.link_ksuite": "Découvrir kSuite", "error.generic.link_login": "Retourner à la page de connexion", diff --git a/webapp/channels/src/i18n/it.json b/webapp/channels/src/i18n/it.json index 8f61dee2c3..c6bd2f2714 100644 --- a/webapp/channels/src/i18n/it.json +++ b/webapp/channels/src/i18n/it.json @@ -2383,6 +2383,9 @@ "error.channel_not_found.message": "Il canale richiesto è privato o non esiste. Contattare un Amministratore per essere aggiunto al canale.", "error.channel_not_found.message_guest": "Il tuo account ospite non ha un canale assegnato. Contatta un amministratore.", "error.channel_not_found.title": "Canale Non Trovato", + "error.force_migration.message": "La tua versione dell'applicazione non è più supportata. Si prega di scaricare e installare la nuova versione per beneficiare degli ultimi miglioramenti.", + "error.force_migration.title": "Scarica la nuova versione dell'applicazione kChat", + "error.generic.dl_link": "Scarica la nuova versione", "error.generic.link": "Torna a {siteName}", "error.generic.link_ksuite": "Scoprire kSuite", "error.generic.link_login": "Torna alla pagina di accesso", diff --git a/webapp/channels/src/packages/mattermost-redux/src/actions/helpers.ts b/webapp/channels/src/packages/mattermost-redux/src/actions/helpers.ts index a5ecfd3e47..d91bc4c706 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/actions/helpers.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/actions/helpers.ts @@ -26,9 +26,10 @@ export function forceLogoutIfNecessary(err: ServerError, dispatch: DispatchFunc, const statusCodes = { HTTP_MAINTENANCE: 503, HTTP_BLOCKED: 401, + FORCE_MIGRATION: 1, }; -function redirectToErrorPageIfNecessary(err: ServerError) { +export function redirectToErrorPageIfNecessary(err: ServerError) { switch (err.status_code) { case statusCodes.HTTP_MAINTENANCE: getHistory().replace('/error?type=maintenance'); @@ -38,6 +39,9 @@ function redirectToErrorPageIfNecessary(err: ServerError) { getHistory().replace('/error?type=blocked'); } break; + case statusCodes.FORCE_MIGRATION: + getHistory().replace('/error?type=force_migration'); + break; } } diff --git a/webapp/channels/src/utils/constants.tsx b/webapp/channels/src/utils/constants.tsx index 24759107f8..4fea0ec7e7 100644 --- a/webapp/channels/src/utils/constants.tsx +++ b/webapp/channels/src/utils/constants.tsx @@ -1023,6 +1023,7 @@ export const ErrorPageTypes = { NO_KSUITE: 'no_ksuite', MAINTENANCE: 'maintenance', BLOCKED: 'blocked', + FORCE_MIGRATION: 'force_migration', }; export const JobTypes = {