fix tests compilation peer session timo - wip
This commit is contained in:
@@ -6,12 +6,16 @@ Please see LICENSE in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { type RoomMember, RoomStateEvent } from "matrix-js-sdk";
|
||||
import { combineLatest, fromEvent, type Observable, startWith } from "rxjs";
|
||||
import {
|
||||
combineLatest,
|
||||
fromEvent,
|
||||
map,
|
||||
type Observable,
|
||||
startWith,
|
||||
} from "rxjs";
|
||||
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
|
||||
import { logger } from "matrix-js-sdk/lib/logger";
|
||||
import { type Room as MatrixRoom } from "matrix-js-sdk/lib/matrix";
|
||||
// eslint-disable-next-line rxjs/no-internal
|
||||
import { type NodeStyleEventEmitter } from "rxjs/internal/observable/fromEvent";
|
||||
|
||||
import { type ObservableScope } from "../ObservableScope";
|
||||
import {
|
||||
@@ -19,6 +23,7 @@ import {
|
||||
shouldDisambiguate,
|
||||
} from "../../utils/displayname";
|
||||
import { type Behavior } from "../Behavior";
|
||||
import type { NodeStyleEventEmitter } from "rxjs/src/internal/observable/fromEvent.ts";
|
||||
|
||||
/**
|
||||
* Displayname for each member of the call. This will disambiguate
|
||||
@@ -36,15 +41,14 @@ export const memberDisplaynames$ = (
|
||||
deviceId: string,
|
||||
): Behavior<Map<string, string>> =>
|
||||
scope.behavior(
|
||||
combineLatest(
|
||||
[
|
||||
// Handle call membership changes
|
||||
memberships$,
|
||||
// Additionally handle display name changes (implicitly reacting to them)
|
||||
fromEvent(matrixRoom, RoomStateEvent.Members).pipe(startWith(null)),
|
||||
// TODO: do we need: pauseWhen(this.pretendToBeDisconnected$),
|
||||
],
|
||||
(memberships, _displaynames) => {
|
||||
combineLatest([
|
||||
// Handle call membership changes
|
||||
memberships$,
|
||||
// Additionally handle display name changes (implicitly reacting to them)
|
||||
fromEvent(matrixRoom, RoomStateEvent.Members).pipe(startWith(null)),
|
||||
// TODO: do we need: pauseWhen(this.pretendToBeDisconnected$),
|
||||
]).pipe(
|
||||
map(([memberships, _displayNames]) => {
|
||||
const displaynameMap = new Map<string, string>([
|
||||
[
|
||||
`${userId}:${deviceId}`,
|
||||
@@ -55,11 +59,12 @@ export const memberDisplaynames$ = (
|
||||
|
||||
// We only consider RTC members for disambiguation as they are the only visible members.
|
||||
for (const rtcMember of memberships) {
|
||||
// TODO a hard-coded participant ID ? should use rtcMember.membershipID instead?
|
||||
const matrixIdentifier = `${rtcMember.userId}:${rtcMember.deviceId}`;
|
||||
const { member } = getRoomMemberFromRtcMember(rtcMember, room);
|
||||
if (!member) {
|
||||
logger.error(
|
||||
"Could not find member for media id:",
|
||||
"Could not find member for participant id:",
|
||||
matrixIdentifier,
|
||||
);
|
||||
continue;
|
||||
@@ -71,7 +76,7 @@ export const memberDisplaynames$ = (
|
||||
);
|
||||
}
|
||||
return displaynameMap;
|
||||
},
|
||||
}),
|
||||
),
|
||||
new Map<string, string>(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user