diff --git a/src/MatrixClientPeg.ts b/src/MatrixClientPeg.ts index 4ea635b5b9..be2151044d 100644 --- a/src/MatrixClientPeg.ts +++ b/src/MatrixClientPeg.ts @@ -51,6 +51,7 @@ import MatrixClientBackedController from "./settings/controllers/MatrixClientBac import ErrorDialog from "./components/views/dialogs/ErrorDialog"; import PlatformPeg from "./PlatformPeg"; import { formatList } from "./utils/FormattingUtils"; +import SdkConfig from "./SdkConfig"; export interface IMatrixClientCreds { homeserverUrl: string; @@ -212,12 +213,21 @@ class MatrixClientPegClass implements IMatrixClientPeg { // If the user is not a guest then prompt them to reload rather than doing it for them // For guests this is likely to happen during e-mail verification as part of registration - const { finished } = Modal.createDialog(ErrorDialog, { - title: _t("error_database_closed_title"), - description: _t("error_database_closed_description"), + const brand = SdkConfig.get().brand; + const platform = PlatformPeg.get()?.getHumanReadableName(); + + // Determine the description based on the platform + const description = + platform === "Web Platform" + ? _t("error_database_closed_description|for_web", { brand }) + : _t("error_database_closed_description|for_desktop"); + + const [reload] = await Modal.createDialog(ErrorDialog, { + title: _t("error_database_closed_title", { brand }), + description, button: _t("action|reload"), - }); - const [reload] = await finished; + }).finished; + if (!reload) return; } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index fe43e73b54..f96bddfc28 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1063,8 +1063,11 @@ "error_app_open_in_another_tab": "Switch to the other tab to connect to %(brand)s. This tab can now be closed.", "error_app_open_in_another_tab_title": "%(brand)s is connected in another tab", "error_app_opened_in_another_window": "%(brand)s is open in another window. Click \"%(label)s\" to use %(brand)s here and disconnect the other window.", - "error_database_closed_description": "This may be caused by having the app open in multiple tabs or due to clearing browser data.", - "error_database_closed_title": "Database unexpectedly closed", + "error_database_closed_description": { + "for_desktop": "Your disk may be full. Please clear up some space and reload.", + "for_web": "If you cleared browsing data then this message is expected. %(brand)s may also be open in another tab, or your disk is full. Please clear up some space and reload" + }, + "error_database_closed_title": "%(brand)s stopped working", "error_dialog": { "copy_room_link_failed": { "description": "Unable to copy a link to the room to the clipboard.", diff --git a/test/MatrixClientPeg-test.ts b/test/MatrixClientPeg-test.ts index b230910244..69306f09f3 100644 --- a/test/MatrixClientPeg-test.ts +++ b/test/MatrixClientPeg-test.ts @@ -155,6 +155,8 @@ describe("MatrixClientPeg", () => { it("should show error modal when store database closes", async () => { testPeg.safeGet().isGuest = () => false; const emitter = new EventEmitter(); + const platform: any = { getHumanReadableName: jest.fn() }; + PlatformPeg.set(platform); testPeg.safeGet().store.on = emitter.on.bind(emitter); const spy = jest.spyOn(Modal, "createDialog"); await testPeg.assign();