fix(inbox): a Takeout import's notice opens the user's own import
The import's notice reaches a user who may not see the Scheduler, an admin page, yet its link opened it. It now opens Settings › Account, where the import's status is; any other run still opens the Scheduler. The job id is held to the server's by the backend-ids contract. The notice's Hungarian names the list as the app does elsewhere.
This commit is contained in:
@@ -205,6 +205,34 @@ describe("NotificationsPanel · a server row", () => {
|
||||
expect(menuRows()).toEqual(["inbox.openTokens", "inbox.markRead", "inbox.dismiss"]);
|
||||
});
|
||||
|
||||
it("a Takeout import's run opens the user's own import, any other run the Scheduler", async () => {
|
||||
const run = (id: number, job: string) =>
|
||||
server(id, {
|
||||
type: "scheduler",
|
||||
data: { job_id: job, status: "ok", summary: `${job} done` },
|
||||
});
|
||||
h.server = [run(1, "takeout_import"), run(2, "channel_backfill")];
|
||||
h.client = [];
|
||||
mount();
|
||||
fireEvent.click(screen.getByText("inbox.openTakeout"));
|
||||
expect(h.focusSettingsTab).toHaveBeenCalledWith("account");
|
||||
expect(h.setPage).toHaveBeenLastCalledWith("settings");
|
||||
fireEvent.click(screen.getByText("inbox.openScheduler"));
|
||||
expect(h.setPage).toHaveBeenLastCalledWith("scheduler");
|
||||
const takeoutRow = screen
|
||||
.getByText("inbox.openTakeout")
|
||||
.closest<HTMLElement>("[data-nav-index]")!;
|
||||
await openMenu(() =>
|
||||
fireEvent.click(takeoutRow.querySelector<HTMLElement>('button[aria-label="inbox.rowMenu"]')!),
|
||||
);
|
||||
expect(menuRows()).toEqual(["inbox.openTakeout", "inbox.markRead", "inbox.dismiss"]);
|
||||
h.focusSettingsTab.mockClear();
|
||||
h.setPage.mockClear();
|
||||
choose("inbox.openTakeout");
|
||||
await waitFor(() => expect(h.focusSettingsTab).toHaveBeenCalledWith("account"));
|
||||
expect(h.setPage).toHaveBeenCalledWith("settings");
|
||||
});
|
||||
|
||||
it("holds the link, mark read and dismiss", async () => {
|
||||
h.server = [server(1)];
|
||||
h.client = [];
|
||||
|
||||
Reference in New Issue
Block a user