diff --git a/patches/error-tchap-is-down/matrix-react-sdk+3.71.1.patch b/patches/error-tchap-is-down/matrix-react-sdk+3.71.1.patch new file mode 100644 index 0000000000..339fd5c400 --- /dev/null +++ b/patches/error-tchap-is-down/matrix-react-sdk+3.71.1.patch @@ -0,0 +1,42 @@ +diff --git a/node_modules/matrix-react-sdk/src/components/structures/RoomSearchView.tsx b/node_modules/matrix-react-sdk/src/components/structures/RoomSearchView.tsx +index 00b9284..e55da17 100644 +--- a/node_modules/matrix-react-sdk/src/components/structures/RoomSearchView.tsx ++++ b/node_modules/matrix-react-sdk/src/components/structures/RoomSearchView.tsx +@@ -34,6 +34,7 @@ import ResizeNotifier from "../../utils/ResizeNotifier"; + import MatrixClientContext from "../../contexts/MatrixClientContext"; + import { RoomPermalinkCreator } from "../../utils/permalinks/Permalinks"; + import RoomContext from "../../contexts/RoomContext"; ++import Tchapi18nUtils from "../../../../../src/tchap/i18n/Tchapi18nUtils"; + + const DEBUG = false; + let debuglog = function (msg: string): void {}; +@@ -129,7 +130,7 @@ export const RoomSearchView = forwardRef( + title: _t("Search failed"), + description: + error?.message ?? +- _t("Server may be unavailable, overloaded, or search timed out :("), ++ Tchapi18nUtils.getServerDownMessage(), + }); + return false; + }, +diff --git a/node_modules/matrix-react-sdk/src/components/structures/RoomStatusBar.tsx b/node_modules/matrix-react-sdk/src/components/structures/RoomStatusBar.tsx +index 24530d4..2f8f555 100644 +--- a/node_modules/matrix-react-sdk/src/components/structures/RoomStatusBar.tsx ++++ b/node_modules/matrix-react-sdk/src/components/structures/RoomStatusBar.tsx +@@ -30,6 +30,7 @@ import AccessibleButton from "../views/elements/AccessibleButton"; + import InlineSpinner from "../views/elements/InlineSpinner"; + import MatrixClientContext from "../../contexts/MatrixClientContext"; + import { RoomStatusBarUnsentMessages } from "./RoomStatusBarUnsentMessages"; ++import Tchapi18nUtils from '../../../../../src/tchap/i18n/Tchapi18nUtils'; // :TCHAP: + + const STATUS_BAR_HIDDEN = 0; + const STATUS_BAR_EXPANDED = 1; +@@ -286,7 +287,7 @@ export default class RoomStatusBar extends React.PureComponent { + /> +
+
+- {_t("Connectivity to the server has been lost.")} ++ {Tchapi18nUtils.getServerDownMessage()} +
+
+ {_t("Sent messages will be stored until your connection has returned.")} diff --git a/patches/forgot-password/matrix-react-sdk+3.71.1.patch b/patches/forgot-password/matrix-react-sdk+3.71.1.patch index 09d7b918f7..0351766663 100644 --- a/patches/forgot-password/matrix-react-sdk+3.71.1.patch +++ b/patches/forgot-password/matrix-react-sdk+3.71.1.patch @@ -1,16 +1,17 @@ diff --git a/node_modules/matrix-react-sdk/src/components/structures/auth/ForgotPassword.tsx b/node_modules/matrix-react-sdk/src/components/structures/auth/ForgotPassword.tsx -index c4c0834..27e9f28 100644 +index c4c0834..880f18e 100644 --- a/node_modules/matrix-react-sdk/src/components/structures/auth/ForgotPassword.tsx +++ b/node_modules/matrix-react-sdk/src/components/structures/auth/ForgotPassword.tsx -@@ -43,6 +43,7 @@ import { VerifyEmailModal } from "./forgot-password/VerifyEmailModal"; +@@ -43,6 +43,8 @@ import { VerifyEmailModal } from "./forgot-password/VerifyEmailModal"; import Spinner from "../../views/elements/Spinner"; import { formatSeconds } from "../../../DateUtils"; import AutoDiscoveryUtils from "../../../utils/AutoDiscoveryUtils"; +import TchapUtils from "../../../../../../src/tchap/util/TchapUtils"; // :TCHAP: ++import Tchapi18nUtils from "../../../../../../src/tchap/i18n/Tchapi18nUtils"; const emailCheckInterval = 2000; -@@ -62,7 +63,7 @@ enum Phase { +@@ -62,7 +64,7 @@ enum Phase { } interface Props { @@ -19,7 +20,7 @@ index c4c0834..27e9f28 100644 onLoginClick: () => void; onComplete: () => void; } -@@ -107,14 +108,17 @@ export default class ForgotPassword extends React.Component { +@@ -107,14 +109,17 @@ export default class ForgotPassword extends React.Component { serverSupportsControlOfDevicesLogout: false, logoutDevices: false, }; @@ -38,7 +39,7 @@ index c4c0834..27e9f28 100644 if ( prevProps.serverConfig.hsUrl !== this.props.serverConfig.hsUrl || prevProps.serverConfig.isUrl !== this.props.serverConfig.isUrl -@@ -125,6 +129,7 @@ export default class ForgotPassword extends React.Component { +@@ -125,6 +130,7 @@ export default class ForgotPassword extends React.Component { // Do capabilities check on new URLs this.checkServerCapabilities(this.props.serverConfig); } @@ -46,7 +47,7 @@ index c4c0834..27e9f28 100644 } private async checkServerLiveliness(serverConfig: ValidatedServerConfig): Promise { -@@ -159,9 +164,38 @@ export default class ForgotPassword extends React.Component { +@@ -159,9 +165,38 @@ export default class ForgotPassword extends React.Component { }); } @@ -73,7 +74,7 @@ index c4c0834..27e9f28 100644 + if (!serverResult) { + this.setState({ + serverIsAlive: false, -+ errorText: _t('Server unavailable, overloaded, or something else went wrong.'), // reuse existing string ++ errorText: Tchapi18nUtils.getServerDownMessage(), + phase: Phase.EnterEmail, // return to original phase, to remove the loding spinner from the submit button. + }); + return; @@ -85,7 +86,7 @@ index c4c0834..27e9f28 100644 if (await this.sendVerificationMail()) { this.phase = Phase.EmailSent; return; -@@ -326,8 +360,10 @@ export default class ForgotPassword extends React.Component { +@@ -326,8 +361,10 @@ export default class ForgotPassword extends React.Component { errorText: "", }); @@ -96,7 +97,7 @@ index c4c0834..27e9f28 100644 // Server error if (!this.state.serverIsAlive) return; -@@ -358,7 +394,7 @@ export default class ForgotPassword extends React.Component { +@@ -358,7 +395,7 @@ export default class ForgotPassword extends React.Component { { +@@ -449,7 +486,9 @@ export default class ForgotPassword extends React.Component { onChange={() => this.setState({ logoutDevices: !this.state.logoutDevices })} checked={this.state.logoutDevices} > diff --git a/patches/login/matrix-react-sdk+3.71.1.patch b/patches/login/matrix-react-sdk+3.71.1.patch index 1ede0fe3f8..155d0f3b2a 100644 --- a/patches/login/matrix-react-sdk+3.71.1.patch +++ b/patches/login/matrix-react-sdk+3.71.1.patch @@ -1,16 +1,17 @@ diff --git a/node_modules/matrix-react-sdk/src/components/structures/auth/Login.tsx b/node_modules/matrix-react-sdk/src/components/structures/auth/Login.tsx -index 4314726..0a34f0e 100644 +index 4314726..a74c9af 100644 --- a/node_modules/matrix-react-sdk/src/components/structures/auth/Login.tsx +++ b/node_modules/matrix-react-sdk/src/components/structures/auth/Login.tsx -@@ -40,6 +40,7 @@ import AuthHeader from "../../views/auth/AuthHeader"; +@@ -40,6 +40,8 @@ import AuthHeader from "../../views/auth/AuthHeader"; import AccessibleButton, { ButtonEvent } from "../../views/elements/AccessibleButton"; import { ValidatedServerConfig } from "../../../utils/ValidatedServerConfig"; import { filterBoolean } from "../../../utils/arrays"; +import TchapUtils from '../../../../../../src/tchap/util/TchapUtils'; // :TCHAP: ++import Tchapi18nUtils from '../../../../../../src/tchap/i18n/Tchapi18nUtils'; // :TCHAP: // These are used in several places, and come from the js-sdk's autodiscovery // stuff. We define them here so that they'll be picked up by i18n. -@@ -167,12 +168,22 @@ export default class LoginComponent extends React.PureComponent +@@ -167,12 +169,22 @@ export default class LoginComponent extends React.PureComponent public isBusy = (): boolean => !!this.state.busy || !!this.props.busy; @@ -33,7 +34,7 @@ index 4314726..0a34f0e 100644 if (!this.state.serverIsAlive) { this.setState({ busy: true }); // Do a quick liveliness check on the URLs -@@ -198,6 +209,7 @@ export default class LoginComponent extends React.PureComponent +@@ -198,6 +210,7 @@ export default class LoginComponent extends React.PureComponent return; } } @@ -41,7 +42,7 @@ index 4314726..0a34f0e 100644 this.setState({ busy: true, -@@ -206,6 +218,22 @@ export default class LoginComponent extends React.PureComponent +@@ -206,6 +219,23 @@ export default class LoginComponent extends React.PureComponent loginIncorrect: false, }); @@ -52,7 +53,8 @@ index 4314726..0a34f0e 100644 + this.setState({ + busy: false, + busyLoggingIn: false, -+ errorText: _t('Server unavailable, overloaded, or something else went wrong.'), // reuse existing string ++ //errorText: _t('Server unavailable, overloaded, or something else went wrong.'), // reuse existing string ++ errorText: Tchapi18nUtils.getServerDownMessage("(err-03)"), + loginIncorrect: false, + }); + return; @@ -64,7 +66,7 @@ index 4314726..0a34f0e 100644 this.loginLogic.loginViaPassword(username, phoneCountry, phoneNumber, password).then( (data) => { this.setState({ serverIsAlive: true }); // it must be, we logged in. -@@ -253,6 +281,10 @@ export default class LoginComponent extends React.PureComponent +@@ -253,6 +283,10 @@ export default class LoginComponent extends React.PureComponent } else { errorText = _t("Incorrect username and/or password."); } @@ -75,7 +77,67 @@ index 4314726..0a34f0e 100644 } else { // other errors, not specific to doing a password login errorText = this.errorTextFromError(error); -@@ -629,10 +661,12 @@ export default class LoginComponent extends React.PureComponent +@@ -454,9 +488,11 @@ export default class LoginComponent extends React.PureComponent + errCode = "HTTP " + err.httpStatus; + } + +- let errorText: ReactNode = +- _t("There was a problem communicating with the homeserver, please try again later.") + +- (errCode ? " (" + errCode + ")" : ""); ++ // let errorText: ReactNode = ++ // _t("There was a problem communicating with the homeserver, please try again later.") + ++ // (errCode ? " (" + errCode + ")" : ""); ++ ++ let errorText: ReactNode = Tchapi18nUtils.getServerDownMessage("("+errCode+")"); + + if (err instanceof ConnectionError) { + if ( +@@ -465,42 +501,13 @@ export default class LoginComponent extends React.PureComponent + ) { + errorText = ( + +- {_t( +- "Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. " + +- "Either use HTTPS or enable unsafe scripts.", +- {}, +- { +- a: (sub) => { +- return ( +- +- {sub} +- +- ); +- }, +- }, +- )} ++ {Tchapi18nUtils.getServerDownMessage("err-01")} + + ); + } else { + errorText = ( + +- {_t( +- "Can't connect to homeserver - please check your connectivity, ensure your " + +- "homeserver's SSL certificate is trusted, and that a browser extension " + +- "is not blocking requests.", +- {}, +- { +- a: (sub) => ( +- +- {sub} +- +- ), +- }, +- )} ++ {Tchapi18nUtils.getServerDownMessage("err-02")} + + ); + } +@@ -629,10 +636,12 @@ export default class LoginComponent extends React.PureComponent {errorTextSection} {serverDeadSection} diff --git a/patches/patches.json b/patches/patches.json index 2d5fa8dbd0..fe321d84c6 100644 --- a/patches/patches.json +++ b/patches/patches.json @@ -62,6 +62,7 @@ "login": { "package": "matrix-react-sdk", + "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/507", "files": [ "src/components/structures/auth/Login.tsx", "src/components/views/auth/PasswordLogin.tsx" @@ -213,5 +214,13 @@ "src/utils/exportUtils/HtmlExport.tsx", "test/utils/exportUtils/HTMLExport-test.ts" ] + }, + "error-tchap-is-down": { + "github-issue": "https://github.com/tchapgouv/tchap-web-v4/issues/507", + "package": "matrix-react-sdk", + "files": [ + "src/components/structures/RoomSearchView.tsx", + "src/components/structures/RoomStatusBar.tsx" + ] } } \ No newline at end of file diff --git a/src/tchap/i18n/Tchapi18nUtils.tsx b/src/tchap/i18n/Tchapi18nUtils.tsx new file mode 100644 index 0000000000..8c1cd24ef5 --- /dev/null +++ b/src/tchap/i18n/Tchapi18nUtils.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import { _t } from "matrix-react-sdk/src/languageHandler"; +import TchapUrls from "../util/TchapUrls"; + + +export default class Tchapi18nUtils { + + public static getServerDownMessage(errCode? : string){ + return _t( + "Review Tchap services status : url", + errCode ? {errCode} : {"errCode": ""}, + { + a: (sub) => ( + + {sub} + + ), + }, + ) + } +} + + diff --git a/src/tchap/i18n/strings/tchap_translations.json b/src/tchap/i18n/strings/tchap_translations.json index 21d1349bba..a21f9fbaee 100644 --- a/src/tchap/i18n/strings/tchap_translations.json +++ b/src/tchap/i18n/strings/tchap_translations.json @@ -962,5 +962,37 @@ "Read the Privacy Policy": { "en": "Read the Privacy Policy", "fr": "Consultez la Politique de Confidentialité" + }, + "Your %(brand)s is misconfigured": { + "fr": "", + "en": "" + }, + "You can also ask your homeserver admin to upgrade the server to change this behaviour.":{ + "fr" : "", + "en" : "" + }, + "Ask your %(brand)s admin to check your config for incorrect or duplicate entries.":{ + "fr" : "", + "en" : "" + }, + "Server may be unavailable, overloaded, or you hit a bug." : { + "fr" : "La connexion à Tchap n'est pas possible pour le moment (err:04). Voir l'état du service: https://status.tchap.numerique.gouv.fr" , + "en" : "Tchap is not available at the moment (err:04). View the status of services: https://status.tchap.numerique.gouv.fr" + }, + "Server unavailable, overloaded, or something else went wrong." : { + "fr" : "La connexion à Tchap n'est pas possible pour le moment (err:03). Voir l'état du service: https://status.tchap.numerique.gouv.fr", + "en" : "Tchap is not available at the moment (err:03). View the status of services: https://status.tchap.numerique.gouv.fr" + }, + "Connectivity to the server has been lost.": { + "fr": "La connexion à Tchap n'est pas possible pour le moment. Voir l'état du service", + "en" : "Tchap is not available at the moment. View the status of services." + }, + "Review Tchap services status : url": { + "fr": "La connexion à Tchap n'est pas possible pour le moment %(errCode)s. Voir l'état du service", + "en": "Tchap is not available at the moment %(errCode)s. View the status of services." + }, + "Sent messages will be stored until your connection has returned.": { + "fr": "Les messages seront envoyés automatiquement dès que la connexion sera rétablie.", + "en": "Messages will be sent when your connection returns." } } diff --git a/src/tchap/util/TchapUrls.ts b/src/tchap/util/TchapUrls.ts index 36c7bdbfab..4784fc09de 100644 --- a/src/tchap/util/TchapUrls.ts +++ b/src/tchap/util/TchapUrls.ts @@ -1,4 +1,8 @@ export default class TchapUrls { //url to request the opening of a new domain on Tchap public static requestDomainUrl = "https://www.demarches-simplifiees.fr/commencer/utiliser-tchap"; + + //tchap status page + public static statusPage = "https://status.tchap.numerique.gouv.fr" + }