Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client): remove redundant titles from status toasts
Elian Doran6a4ecb059928
diff --git a/apps/client/src/services/branches.ts b/apps/client/src/services/branches.tsindex 15d24a10d7..a5c646ae7a 100644--- a/apps/client/src/services/branches.ts+++ b/apps/client/src/services/branches.ts@@ -213,7 +213,6 @@ function filterRootNote(branchIds: string[]) {function makeToast(id: string, message: string): ToastOptionsWithRequiredId {return {id,- title: t("branches.delete-status"),message,icon: "trash"};diff --git a/apps/client/src/services/protected_session.spec.ts b/apps/client/src/services/protected_session.spec.tsindex 5c5486016c..43bca0b928 100644--- a/apps/client/src/services/protected_session.spec.ts+++ b/apps/client/src/services/protected_session.spec.ts@@ -255,16 +255,15 @@ describe("protectNotes task ws handler", () => {});// Beyond id/icon, the toast must carry the interpolated progress text- // (protecting key + the progressCount) and the protecting title. The- // mocked `t` serializes the selected KEY and `count`, so we assert- // structure/args, never a translated string.+ // (protecting key + the progressCount). The mocked `t` serializes the+ // selected KEY and `count`, so we assert structure/args, never a+ // translated string.const toast = showPersistent.mock.calls[0][0] as ToastOptionsWithRequiredId;expect(showPersistent).toHaveBeenCalledWith(expect.objectContaining({id: "task-prot",icon: "check-shield",- message: "protected_session.protecting-in-progress:count=5",- title: "protected_session.protecting-title"+ message: "protected_session.protecting-in-progress:count=5"}));// The progressCount must be interpolated into the message.@@ -287,8 +286,7 @@ describe("protectNotes task ws handler", () => {expect.objectContaining({id: "task-unprot",icon: "shield",- message: "protected_session.unprotecting-in-progress-count:count=2",- title: "protected_session.unprotecting-title"+ message: "protected_session.unprotecting-in-progress-count:count=2"}));expect(toast.message).toContain("count=2");@@ -317,10 +315,9 @@ describe("protectNotes task ws handler", () => {const protectingToast = showPersistent.mock.calls[0][0] as ToastOptionsWithRequiredId;const unprotectingToast = showPersistent.mock.calls[1][0] as ToastOptionsWithRequiredId;- // Same progressCount, opposite protect flag => the message/title text must+ // Same progressCount, opposite protect flag => the message text must// diverge (different translation keys are selected per branch).expect(protectingToast.message).not.toBe(unprotectingToast.message);- expect(protectingToast.title).not.toBe(unprotectingToast.title);});it("shows a timed success toast on taskSucceeded for both protecting and unprotecting", async () => {diff --git a/apps/client/src/services/protected_session.ts b/apps/client/src/services/protected_session.tsindex 395a844bb1..54c75af576 100644--- a/apps/client/src/services/protected_session.ts+++ b/apps/client/src/services/protected_session.ts@@ -97,10 +97,9 @@ async function protectNote(noteId: string, protect: boolean, includingSubtree: bawait server.put(`notes/${noteId}/protect/${protect ? 1 : 0}?subtree=${includingSubtree ? 1 : 0}`);}-function makeToast(message: Message, title: string, text: string): ToastOptionsWithRequiredId {+function makeToast(message: Message, text: string): ToastOptionsWithRequiredId {return {id: message.taskId,- title,message: text,icon: message.data.protect ? "check-shield" : "shield"};@@ -112,7 +111,6 @@ ws.subscribeToMessages(async (message) => {}const isProtecting = message.data?.protect;- const title = isProtecting ? t("protected_session.protecting-title") : t("protected_session.unprotecting-title");if (message.type === "taskError") {toastService.closePersistent(message.taskId);@@ -120,10 +118,10 @@ ws.subscribeToMessages(async (message) => {} else if (message.type === "taskProgressCount") {const count = message.progressCount;const text = isProtecting ? t("protected_session.protecting-in-progress", { count }) : t("protected_session.unprotecting-in-progress-count", { count });- toastService.showPersistent(makeToast(message, title, text));+ toastService.showPersistent(makeToast(message, text));} else if (message.type === "taskSucceeded") {const text = isProtecting ? t("protected_session.protecting-finished-successfully") : t("protected_session.unprotecting-finished-successfully");- const toast = makeToast(message, title, text);+ const toast = makeToast(message, text);toast.timeout = 3000;toastService.showPersistent(toast);diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 637e5bd7cd..ece0f8981b 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -138,7 +138,6 @@"export_type_single": "Only this note without its descendants","export": "Export","choose_export_type": "Choose export type first please",- "export_status": "Export status","export_in_progress": "Export in progress: {{progressCount}}","export_finished_successfully": "Export finished successfully.","format_pdf": "PDF - for printing or sharing purposes.",@@ -1242,9 +1241,7 @@"protecting-finished-successfully": "Protecting finished successfully.","unprotecting-finished-successfully": "Unprotecting finished successfully.","protecting-in-progress": "Protecting in progress: {{count}}",- "unprotecting-in-progress-count": "Unprotecting in progress: {{count}}",- "protecting-title": "Protecting status",- "unprotecting-title": "Unprotecting status"+ "unprotecting-in-progress-count": "Unprotecting in progress: {{count}}"},"relation_map": {"remove_note": "Remove note",@@ -2201,7 +2198,6 @@},"branches": {"cannot-move-notes-here": "Cannot move notes here.",- "delete-status": "Delete status","delete-notes-in-progress": "Delete notes in progress: {{count}}","delete-finished-successfully": "Delete finished successfully.","undeleting-notes-in-progress": "Undeleting notes in progress: {{count}}",diff --git a/apps/client/src/widgets/dialogs/export.tsx b/apps/client/src/widgets/dialogs/export.tsxindex d31bf6a126..547ea712b7 100644--- a/apps/client/src/widgets/dialogs/export.tsx+++ b/apps/client/src/widgets/dialogs/export.tsx@@ -137,7 +137,6 @@ ws.subscribeToMessages(async (message) => {function makeToast(id: string, message: string): ToastOptionsWithRequiredId {return {id,- title: t("export.export_status"),message,icon: "export"};