cleaning: Stop using deprecated callMembershipsForRoom (#31616)
* cleaning: Stop using deprecated callMembershipsForRoom * fix test * review: Added quick doc
This commit is contained in:
+8
-3
@@ -25,7 +25,7 @@ import {
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { type PermissionChanged as PermissionChangedEvent } from "@matrix-org/analytics-events/types/typescript/PermissionChanged";
|
||||
import { type IRTCNotificationContent, MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc";
|
||||
import { type IRTCNotificationContent } from "matrix-js-sdk/src/matrixrtc";
|
||||
|
||||
import { MatrixClientPeg } from "./MatrixClientPeg";
|
||||
import { PosthogAnalytics } from "./PosthogAnalytics";
|
||||
@@ -486,8 +486,13 @@ class NotifierClass extends TypedEventEmitter<keyof EmittedEvents, EmittedEvents
|
||||
private performCustomEventHandling(ev: MatrixEvent): void {
|
||||
const cli = MatrixClientPeg.safeGet();
|
||||
const room = cli.getRoom(ev.getRoomId());
|
||||
const thisUserHasConnectedDevice =
|
||||
room && MatrixRTCSession.callMembershipsForRoom(room).some((m) => m.sender === cli.getUserId());
|
||||
const rtcSession = room ? cli.matrixRTC.getRoomSession(room) : null;
|
||||
let thisUserHasConnectedDevice = false;
|
||||
if (rtcSession?.slotDescription?.application == "m.call") {
|
||||
// Get the current state, the actual IncomingCallToast will update as needed by
|
||||
// listening to the rtcSession directly.
|
||||
thisUserHasConnectedDevice = rtcSession.memberships.some((m) => m.userId === cli.getUserId());
|
||||
}
|
||||
|
||||
if (EventType.RTCNotification === ev.getType() && !thisUserHasConnectedDevice) {
|
||||
const content = ev.getContent() as IRTCNotificationContent;
|
||||
|
||||
Reference in New Issue
Block a user