diff --git a/src/state/CallViewModel/CallNotificationLifecycle.test.ts b/src/state/CallViewModel/CallNotificationLifecycle.test.ts index 236c126a..e5463e93 100644 --- a/src/state/CallViewModel/CallNotificationLifecycle.test.ts +++ b/src/state/CallViewModel/CallNotificationLifecycle.test.ts @@ -5,10 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE in the repository root for full details. */ -import { - type ICallNotifyContent, - type IRTCNotificationContent, -} from "matrix-js-sdk/lib/matrixrtc"; +import { type IRTCNotificationContent } from "matrix-js-sdk/lib/matrixrtc"; import { describe, it } from "vitest"; import { EventType, @@ -30,7 +27,6 @@ import { } from "./CallNotificationLifecycle"; import { trackEpoch } from "../ObservableScope"; -const mockLegacyRingEvent = {} as { event_id: string } & ICallNotifyContent; function mockRingEvent( eventId: string, lifetimeMs: number | undefined, @@ -54,7 +50,7 @@ describe("waitForCallPickup$", () => { behavior("a", { a: [] }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$notif1", 30), mockLegacyRingEvent], + a: [mockRingEvent("$notif1", 30)], }), receivedDecline$: hot(""), options: { @@ -86,7 +82,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("5ms a", { - a: [mockRingEvent("$notif2", 100), mockLegacyRingEvent], + a: [mockRingEvent("$notif2", 100)], }), receivedDecline$: hot(""), options: { @@ -115,7 +111,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("20ms a", { - a: [mockRingEvent("$notif2", 50), mockLegacyRingEvent], + a: [mockRingEvent("$notif2", 50)], }), receivedDecline$: hot(""), options: { @@ -142,7 +138,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$notif2", undefined), mockLegacyRingEvent], + a: [mockRingEvent("$notif2", undefined)], }), receivedDecline$: hot(""), options: { @@ -171,7 +167,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$notif5", 30), mockLegacyRingEvent], + a: [mockRingEvent("$notif5", 30)], }), receivedDecline$: hot(""), options: { @@ -210,7 +206,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$decl1", 50), mockLegacyRingEvent], + a: [mockRingEvent("$decl1", 50)], }), receivedDecline$: hot("40ms d", { d: [ @@ -254,7 +250,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$decl", 20), mockLegacyRingEvent], + a: [mockRingEvent("$decl", 20)], }), receivedDecline$: hot("40ms d", { d: [ @@ -305,7 +301,7 @@ describe("waitForCallPickup$", () => { }).pipe(trackEpoch()), ), sentCallNotification$: hot("10ms a", { - a: [mockRingEvent("$right", 50), mockLegacyRingEvent], + a: [mockRingEvent("$right", 50)], }), receivedDecline$: hot("20ms d", { d: [ diff --git a/src/state/CallViewModel/CallNotificationLifecycle.ts b/src/state/CallViewModel/CallNotificationLifecycle.ts index d90f35ba..b56e2f40 100644 --- a/src/state/CallViewModel/CallNotificationLifecycle.ts +++ b/src/state/CallViewModel/CallNotificationLifecycle.ts @@ -140,9 +140,9 @@ export function createCallNotificationLifecycle$({ scope.behavior( sentCallNotification$.pipe( filter( - (newAndLegacyEvents) => + (notificationEventArgs) => // only care about new events (legacy do not have decline pattern) - newAndLegacyEvents?.[0].notification_type === "ring", + notificationEventArgs?.[0].notification_type === "ring", ), map((e) => e as CallNotificationWrapper), switchMap(([notificationEvent]) => { diff --git a/src/state/CallViewModel/CallViewModel.test.ts b/src/state/CallViewModel/CallViewModel.test.ts index c355c627..5ee679b0 100644 --- a/src/state/CallViewModel/CallViewModel.test.ts +++ b/src/state/CallViewModel/CallViewModel.test.ts @@ -29,7 +29,6 @@ import { Status, type CallMembership, type IRTCNotificationContent, - type ICallNotifyContent, MatrixRTCSessionEvent, type LivekitTransport, } from "matrix-js-sdk/lib/matrixrtc"; @@ -232,10 +231,6 @@ function mockRingEvent( } as unknown as { event_id: string } & IRTCNotificationContent; } -// The app doesn't really care about the content of these legacy events, we just -// need a value to fill in for them when emitting notifications -const mockLegacyRingEvent = {} as { event_id: string } & ICallNotifyContent; - describe.each([ [MatrixRTCMode.Legacy], [MatrixRTCMode.Compatibility], @@ -1109,7 +1104,6 @@ describe.each([ rtcSession.emit( MatrixRTCSessionEvent.DidSendCallNotification, mockRingEvent("$notif1", 30), - mockLegacyRingEvent, ); }, }); @@ -1151,7 +1145,6 @@ describe.each([ rtcSession.emit( MatrixRTCSessionEvent.DidSendCallNotification, mockRingEvent("$notif2", 100), - mockLegacyRingEvent, ); }, d: () => {