mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-30 00:50:48 +08:00
Disambiguate between types of "member" (#2807)
We have Matrix room members and MatrixRTC session memberships. Livekit also has rooms. So, this attempts to make it more obvious as to what type you are referring to.
This commit is contained in:
parent
9176e06195
commit
3885eefa4c
@ -30,7 +30,7 @@ import {
|
|||||||
mockLivekitRoom,
|
mockLivekitRoom,
|
||||||
mockLocalParticipant,
|
mockLocalParticipant,
|
||||||
mockMatrixRoom,
|
mockMatrixRoom,
|
||||||
mockMember,
|
mockMatrixRoomMember,
|
||||||
mockRemoteParticipant,
|
mockRemoteParticipant,
|
||||||
withTestScheduler,
|
withTestScheduler,
|
||||||
} from "../utils/test";
|
} from "../utils/test";
|
||||||
@ -42,10 +42,10 @@ import { E2eeType } from "../e2ee/e2eeType";
|
|||||||
|
|
||||||
vi.mock("@livekit/components-core");
|
vi.mock("@livekit/components-core");
|
||||||
|
|
||||||
const alice = mockMember({ userId: "@alice:example.org" });
|
const alice = mockMatrixRoomMember({ userId: "@alice:example.org" });
|
||||||
const bob = mockMember({ userId: "@bob:example.org" });
|
const bob = mockMatrixRoomMember({ userId: "@bob:example.org" });
|
||||||
const carol = mockMember({ userId: "@carol:example.org" });
|
const carol = mockMatrixRoomMember({ userId: "@carol:example.org" });
|
||||||
const dave = mockMember({ userId: "@dave:example.org" });
|
const dave = mockMatrixRoomMember({ userId: "@dave:example.org" });
|
||||||
|
|
||||||
const aliceId = `${alice.userId}:AAAA`;
|
const aliceId = `${alice.userId}:AAAA`;
|
||||||
const bobId = `${bob.userId}:BBBB`;
|
const bobId = `${bob.userId}:BBBB`;
|
||||||
|
@ -306,7 +306,7 @@ class ScreenShare {
|
|||||||
|
|
||||||
type MediaItem = UserMedia | ScreenShare;
|
type MediaItem = UserMedia | ScreenShare;
|
||||||
|
|
||||||
function findMatrixMember(
|
function findMatrixRoomMember(
|
||||||
room: MatrixRoom,
|
room: MatrixRoom,
|
||||||
id: string,
|
id: string,
|
||||||
): RoomMember | undefined {
|
): RoomMember | undefined {
|
||||||
@ -428,7 +428,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
||||||
for (const p of [localParticipant, ...remoteParticipants]) {
|
for (const p of [localParticipant, ...remoteParticipants]) {
|
||||||
const id = p === localParticipant ? "local" : p.identity;
|
const id = p === localParticipant ? "local" : p.identity;
|
||||||
const member = findMatrixMember(this.matrixRoom, id);
|
const member = findMatrixRoomMember(this.matrixRoom, id);
|
||||||
if (member === undefined)
|
if (member === undefined)
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`,
|
`Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`,
|
||||||
|
@ -99,7 +99,7 @@ function mockEmitter<T>(): EmitterMock<T> {
|
|||||||
// Maybe it'd be good to move this to matrix-js-sdk? Our testing needs are
|
// Maybe it'd be good to move this to matrix-js-sdk? Our testing needs are
|
||||||
// rather simple, but if one util to mock a member is good enough for us, maybe
|
// rather simple, but if one util to mock a member is good enough for us, maybe
|
||||||
// it's useful for matrix-js-sdk consumers in general.
|
// it's useful for matrix-js-sdk consumers in general.
|
||||||
export function mockMember(member: Partial<RoomMember>): RoomMember {
|
export function mockMatrixRoomMember(member: Partial<RoomMember>): RoomMember {
|
||||||
return { ...mockEmitter(), ...member } as RoomMember;
|
return { ...mockEmitter(), ...member } as RoomMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ export async function withLocalMedia(
|
|||||||
const localParticipant = mockLocalParticipant({});
|
const localParticipant = mockLocalParticipant({});
|
||||||
const vm = new LocalUserMediaViewModel(
|
const vm = new LocalUserMediaViewModel(
|
||||||
"local",
|
"local",
|
||||||
mockMember(member),
|
mockMatrixRoomMember(member),
|
||||||
localParticipant,
|
localParticipant,
|
||||||
{
|
{
|
||||||
kind: E2eeType.PER_PARTICIPANT,
|
kind: E2eeType.PER_PARTICIPANT,
|
||||||
@ -184,7 +184,7 @@ export async function withRemoteMedia(
|
|||||||
const remoteParticipant = mockRemoteParticipant(participant);
|
const remoteParticipant = mockRemoteParticipant(participant);
|
||||||
const vm = new RemoteUserMediaViewModel(
|
const vm = new RemoteUserMediaViewModel(
|
||||||
"remote",
|
"remote",
|
||||||
mockMember(member),
|
mockMatrixRoomMember(member),
|
||||||
remoteParticipant,
|
remoteParticipant,
|
||||||
{
|
{
|
||||||
kind: E2eeType.PER_PARTICIPANT,
|
kind: E2eeType.PER_PARTICIPANT,
|
||||||
|
Loading…
Reference in New Issue
Block a user