mirror of https://github.com/vector-im/riot-web
Added meaning full error message based on platform (#12074)
* fix: fixed 'Database unexpectedly closed' is a bad error message (#25948) * Added deviceType condition check for web and desktop * Added Error description for web and desktop * Changed 'error_database_closed_title' Title to '%(brand)s stopped working' Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> * refactor(platform): replace UA parsing with Platform for platform detection Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> * refactor(platform-test): added getHumanReadableName function in testcase Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> * refactor(platform): added %brand argument for description Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> * refactor by linter Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> * refactor(linter): used prettier for linter * Enable `A thread with a redacted unread is still read after restart` (#12083) * [create-pull-request] automated change (#12085) Co-authored-by: github-merge-queue <github-merge-queue@users.noreply.github.com> * Allow element-web hash to be specified when calling playwright tests workflow (#12087) * add link to issue for disabled test * [create-pull-request] automated change (#12093) Co-authored-by: github-merge-queue <github-merge-queue@users.noreply.github.com> * Add tests about room list order (#12088) --------- Signed-off-by: Pankaj Singh <pankajsingh132000@gmail.com> Co-authored-by: Florian Duros <florianduros@element.io> Co-authored-by: ElementRobot <releases@riot.im> Co-authored-by: github-merge-queue <github-merge-queue@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: Richard van der Hoff <richard@matrix.org>pull/28217/head
parent
176237ee9b
commit
773b03e15e
|
@ -51,6 +51,7 @@ import MatrixClientBackedController from "./settings/controllers/MatrixClientBac
|
||||||
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
||||||
import PlatformPeg from "./PlatformPeg";
|
import PlatformPeg from "./PlatformPeg";
|
||||||
import { formatList } from "./utils/FormattingUtils";
|
import { formatList } from "./utils/FormattingUtils";
|
||||||
|
import SdkConfig from "./SdkConfig";
|
||||||
|
|
||||||
export interface IMatrixClientCreds {
|
export interface IMatrixClientCreds {
|
||||||
homeserverUrl: string;
|
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
|
// 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
|
// For guests this is likely to happen during e-mail verification as part of registration
|
||||||
|
|
||||||
const { finished } = Modal.createDialog(ErrorDialog, {
|
const brand = SdkConfig.get().brand;
|
||||||
title: _t("error_database_closed_title"),
|
const platform = PlatformPeg.get()?.getHumanReadableName();
|
||||||
description: _t("error_database_closed_description"),
|
|
||||||
|
// 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"),
|
button: _t("action|reload"),
|
||||||
});
|
}).finished;
|
||||||
const [reload] = await finished;
|
|
||||||
if (!reload) return;
|
if (!reload) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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": "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_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_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_description": {
|
||||||
"error_database_closed_title": "Database unexpectedly closed",
|
"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": {
|
"error_dialog": {
|
||||||
"copy_room_link_failed": {
|
"copy_room_link_failed": {
|
||||||
"description": "Unable to copy a link to the room to the clipboard.",
|
"description": "Unable to copy a link to the room to the clipboard.",
|
||||||
|
|
|
@ -155,6 +155,8 @@ describe("MatrixClientPeg", () => {
|
||||||
it("should show error modal when store database closes", async () => {
|
it("should show error modal when store database closes", async () => {
|
||||||
testPeg.safeGet().isGuest = () => false;
|
testPeg.safeGet().isGuest = () => false;
|
||||||
const emitter = new EventEmitter();
|
const emitter = new EventEmitter();
|
||||||
|
const platform: any = { getHumanReadableName: jest.fn() };
|
||||||
|
PlatformPeg.set(platform);
|
||||||
testPeg.safeGet().store.on = emitter.on.bind(emitter);
|
testPeg.safeGet().store.on = emitter.on.bind(emitter);
|
||||||
const spy = jest.spyOn(Modal, "createDialog");
|
const spy = jest.spyOn(Modal, "createDialog");
|
||||||
await testPeg.assign();
|
await testPeg.assign();
|
||||||
|
|
Loading…
Reference in New Issue