diff --git a/playwright/snapshots/crypto/toasts.spec.ts/key-storage-out-of-sync-toast-linux.png b/playwright/snapshots/crypto/toasts.spec.ts/key-storage-out-of-sync-toast-linux.png index c5ca8fdc02..f5514af8cf 100644 Binary files a/playwright/snapshots/crypto/toasts.spec.ts/key-storage-out-of-sync-toast-linux.png and b/playwright/snapshots/crypto/toasts.spec.ts/key-storage-out-of-sync-toast-linux.png differ diff --git a/res/css/structures/_ToastContainer.pcss b/res/css/structures/_ToastContainer.pcss index 68b39cae61..255aef685c 100644 --- a/res/css/structures/_ToastContainer.pcss +++ b/res/css/structures/_ToastContainer.pcss @@ -78,13 +78,6 @@ Please see LICENSE files in the repository root for full details. display: inline; width: auto; } - - .mx_Toast_title_countIndicator { - font-size: $font-12px; - line-height: $font-22px; - color: $secondary-content; - margin-inline-start: auto; /* on the end side of the div */ - } } .mx_Toast_body { diff --git a/src/components/structures/ToastContainer.tsx b/src/components/structures/ToastContainer.tsx index a84af5a504..21245dbe2f 100644 --- a/src/components/structures/ToastContainer.tsx +++ b/src/components/structures/ToastContainer.tsx @@ -15,7 +15,6 @@ import ToastStore, { type IToast } from "../../stores/ToastStore"; interface IState { toasts: IToast[]; - countSeen: number; } export default class ToastContainer extends React.Component { @@ -23,7 +22,6 @@ export default class ToastContainer extends React.Component super(props); this.state = { toasts: ToastStore.sharedInstance().getToasts(), - countSeen: ToastStore.sharedInstance().getCountSeen(), }; } @@ -39,7 +37,6 @@ export default class ToastContainer extends React.Component private onToastStoreUpdate = (): void => { this.setState({ toasts: ToastStore.sharedInstance().getToasts(), - countSeen: ToastStore.sharedInstance().getCountSeen(), }); }; @@ -61,11 +58,6 @@ export default class ToastContainer extends React.Component }); const content = React.createElement(component, toastProps); - let countIndicator; - if ((title && isStacked) || this.state.countSeen > 0) { - countIndicator = ` (${this.state.countSeen + 1}/${this.state.countSeen + totalCount})`; - } - let titleElement; if (title) { titleElement = ( @@ -73,7 +65,6 @@ export default class ToastContainer extends React.Component {title} - {countIndicator} ); } diff --git a/src/stores/ToastStore.ts b/src/stores/ToastStore.ts index 41a78ed460..6541ad7a0c 100644 --- a/src/stores/ToastStore.ts +++ b/src/stores/ToastStore.ts @@ -30,9 +30,6 @@ export interface IToast { */ export default class ToastStore extends EventEmitter { private toasts: IToast[] = []; - // The count of toasts which have been seen & dealt with in this stack - // where the count resets when the stack of toasts clears. - private countSeen = 0; public static sharedInstance(): ToastStore { if (!window.mxToastStore) window.mxToastStore = new ToastStore(); @@ -41,7 +38,6 @@ export default class ToastStore extends EventEmitter { public reset(): void { this.toasts = []; - this.countSeen = 0; } /** @@ -68,18 +64,10 @@ export default class ToastStore extends EventEmitter { } public dismissToast(key: string): void { - if (this.toasts[0] && this.toasts[0].key === key) { - this.countSeen++; - } - const length = this.toasts.length; this.toasts = this.toasts.filter((t) => t.key !== key); if (length !== this.toasts.length) { logger.info(`Removed toast with key '${key}'`); - if (this.toasts.length === 0) { - this.countSeen = 0; - } - this.emit("update"); } } @@ -87,8 +75,4 @@ export default class ToastStore extends EventEmitter { public getToasts(): IToast[] { return this.toasts; } - - public getCountSeen(): number { - return this.countSeen; - } } diff --git a/test/unit-tests/stores/ToastStore-test.ts b/test/unit-tests/stores/ToastStore-test.ts index 612721a1c5..a5a16eb856 100644 --- a/test/unit-tests/stores/ToastStore-test.ts +++ b/test/unit-tests/stores/ToastStore-test.ts @@ -71,7 +71,6 @@ describe("ToastStore", () => { store.dismissToast("whatever"); - expect(store.getCountSeen()).toEqual(0); expect(emitSpy).not.toHaveBeenCalled(); }); @@ -85,43 +84,13 @@ describe("ToastStore", () => { store.dismissToast(toastA.key); - expect(store.getCountSeen()).toEqual(0); expect(emitSpy).toHaveBeenCalledWith("update"); expect(store.getToasts()).toEqual([toastB]); }); - - it("increments countSeen when toast has bottom priority", () => { - const store = new ToastStore(); - const toastA = makeToast(1, "a"); - const toastB = makeToast(3, "b"); - const toastC = makeToast(99, "c"); - store.addOrReplaceToast(toastA); - store.addOrReplaceToast(toastC); - store.addOrReplaceToast(toastB); - const emitSpy = jest.spyOn(store, "emit"); - - store.dismissToast(toastC.key); - - expect(store.getCountSeen()).toEqual(1); - expect(emitSpy).toHaveBeenCalledWith("update"); - }); - - it("resets countSeen when no toasts remain", () => { - const store = new ToastStore(); - const toastA = makeToast(1, "a"); - const toastB = makeToast(3, "b"); - store.addOrReplaceToast(toastA); - store.addOrReplaceToast(toastB); - - store.dismissToast(toastB.key); - expect(store.getCountSeen()).toEqual(1); - store.dismissToast(toastA.key); - expect(store.getCountSeen()).toEqual(0); - }); }); describe("reset()", () => { - it("clears countseen and toasts", () => { + it("clears toasts", () => { const store = new ToastStore(); const toastA = makeToast(1, "a"); const toastB = makeToast(3, "b"); @@ -131,7 +100,6 @@ describe("ToastStore", () => { store.dismissToast(toastB.key); store.reset(); - expect(store.getCountSeen()).toEqual(0); expect(store.getToasts()).toEqual([]); }); }); diff --git a/test/unit-tests/toasts/__snapshots__/UnverifiedSessionToast-test.tsx.snap b/test/unit-tests/toasts/__snapshots__/UnverifiedSessionToast-test.tsx.snap index 067578b65d..4e02f704ad 100644 --- a/test/unit-tests/toasts/__snapshots__/UnverifiedSessionToast-test.tsx.snap +++ b/test/unit-tests/toasts/__snapshots__/UnverifiedSessionToast-test.tsx.snap @@ -30,9 +30,6 @@ exports[`UnverifiedSessionToast when rendering the toast should render as expect > New login. Was this you? -