Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Added meaning full error message based on platform #12074

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5299037
fix: fixed 'Database unexpectedly closed' is a bad error message (#25…
Pankaj-SinghR Dec 20, 2023
de62e02
Merge branch 'develop' into fix/database-unexpectedly-close-message
Pankaj-SinghR Dec 20, 2023
e05e90c
Merge branch 'develop' into fix/database-unexpectedly-close-message
Pankaj-SinghR Dec 20, 2023
2325415
Merge branch 'matrix-org:develop' into fix/database-unexpectedly-clos…
Pankaj-SinghR Dec 20, 2023
62956ce
refactor(platform): replace UA parsing with Platform for platform det…
Pankaj-SinghR Dec 20, 2023
e86394a
Merge branch 'develop' into fix/database-unexpectedly-close-message
Pankaj-SinghR Dec 21, 2023
97fde92
Merge branch 'matrix-org:develop' into fix/database-unexpectedly-clos…
Pankaj-SinghR Dec 21, 2023
7b52ced
refactor(platform-test): added getHumanReadableName function in testcase
Pankaj-SinghR Dec 21, 2023
c07bf8b
refactor(platform): added %brand argument for description
Pankaj-SinghR Dec 21, 2023
0ebb9a5
refactor by linter
Pankaj-SinghR Dec 21, 2023
0d35539
refactor(linter): used prettier for linter
Pankaj-SinghR Dec 29, 2023
442ec23
Enable `A thread with a redacted unread is still read after restart` …
florianduros Dec 21, 2023
e4d382c
[create-pull-request] automated change (#12085)
RiotRobot Dec 22, 2023
cb4b5f5
Allow element-web hash to be specified when calling playwright tests …
t3chguy Dec 22, 2023
dce38db
add link to issue for disabled test
richvdh Dec 28, 2023
069d591
[create-pull-request] automated change (#12093)
RiotRobot Dec 29, 2023
4ec2e18
Add tests about room list order (#12088)
florianduros Dec 29, 2023
0ab1f99
Merge branch 'develop' into fix/database-unexpectedly-close-message
Pankaj-SinghR Dec 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions src/MatrixClientPeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
7 changes: 5 additions & 2 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 2 additions & 0 deletions test/MatrixClientPeg-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down