fix(notifications): a notice value is no plain string, so a translated name cannot freeze in one language
A name goes in as raw(), a translated word as its own msg(): tsc now lists every value, and the ones that froze are said when shown — Watch later and an untitled channel in the pin and channel notices, a Plex season's name in its removal toast (a new seasonTitleText, which seasonTitle says).
This commit is contained in:
@@ -70,7 +70,7 @@ vi.mock("../../lib/notifications", async (importOriginal) => ({
|
||||
}));
|
||||
|
||||
import DownloadTray from "./DownloadTray";
|
||||
import { msg, type NotifText } from "../../lib/notifications";
|
||||
import { msg, type NotifText, raw } from "../../lib/notifications";
|
||||
import { noteQueue, resetQueueWatch, showInTray } from "../../lib/downloadQueue";
|
||||
import { pushLayer, removeLayer } from "../../lib/layerStack";
|
||||
import { qk } from "../../lib/queryKeys";
|
||||
@@ -205,7 +205,7 @@ describe("DownloadTray", () => {
|
||||
action: { label: string; onClick: () => void };
|
||||
secondaryAction: { label: string; onClick: () => void };
|
||||
};
|
||||
expect(notice.title).toEqual(msg("tray.done.title", { title: "Clip 1" }));
|
||||
expect(notice.title).toEqual(msg("tray.done.title", { title: raw("Clip 1") }));
|
||||
expect(notice.message).toEqual(msg("tray.done.phone"));
|
||||
expect(notice.action.label).toBe("tray.done.copyLink");
|
||||
notice.action.onClick();
|
||||
@@ -227,8 +227,8 @@ describe("DownloadTray", () => {
|
||||
poll([job(1, "done"), job(2, "done")], view);
|
||||
await waitFor(() => expect(h.notify).toHaveBeenCalledTimes(2));
|
||||
expect(h.notify.mock.calls.map((c) => (c[0] as { title: NotifText }).title)).toEqual([
|
||||
msg("tray.done.title", { title: "Clip 1" }),
|
||||
msg("tray.done.title", { title: "Clip 2" }),
|
||||
msg("tray.done.title", { title: raw("Clip 1") }),
|
||||
msg("tray.done.title", { title: raw("Clip 2") }),
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -260,7 +260,9 @@ describe("DownloadTray", () => {
|
||||
poll([job(1, "done", { source_key: "upload" })], view);
|
||||
await waitFor(() =>
|
||||
expect(h.notify).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ title: msg("tray.done.uploadedTitle", { title: "Clip 1" }) }),
|
||||
expect.objectContaining({
|
||||
title: msg("tray.done.uploadedTitle", { title: raw("Clip 1") }),
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user