use actual uuid for member.id
review with some renaming and removal of unnecassary if
This commit is contained in:
@@ -47,6 +47,7 @@ import {
|
|||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { type IWidgetApiRequest } from "matrix-widget-api";
|
import { type IWidgetApiRequest } from "matrix-widget-api";
|
||||||
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
||||||
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
LocalUserMediaViewModel,
|
LocalUserMediaViewModel,
|
||||||
@@ -430,9 +431,8 @@ export function createCallViewModel$(
|
|||||||
const ownMembershipIdentity: CallMembershipIdentityParts = {
|
const ownMembershipIdentity: CallMembershipIdentityParts = {
|
||||||
userId,
|
userId,
|
||||||
deviceId,
|
deviceId,
|
||||||
// This will eventually become the salt for the hash endpoint.
|
// This will only be consumed by the sticky membership manager. So it has no impact on legacy calls.
|
||||||
// For now we keep it as the user+device string since it is expected by non matrix matrixRTCMode === Legacy.
|
memberId: uuidv4(),
|
||||||
memberId: `${userId}:${deviceId}`,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const localTransport$ = createLocalTransport$({
|
const localTransport$ = createLocalTransport$({
|
||||||
@@ -722,22 +722,20 @@ export function createCallViewModel$(
|
|||||||
if (localMatrixLivekitMember) {
|
if (localMatrixLivekitMember) {
|
||||||
const { userId, participant, connection$, membership$ } =
|
const { userId, participant, connection$, membership$ } =
|
||||||
localMatrixLivekitMember;
|
localMatrixLivekitMember;
|
||||||
localUserMediaId = `${userId}:${membership$.value.deviceId}`; // should be membership$.value.membershipID which is not optional
|
|
||||||
|
|
||||||
if (localUserMediaId) {
|
localUserMediaId = `${userId}:${membership$.value.deviceId}`;
|
||||||
for (let dup = 0; dup < 1 + duplicateTiles; dup++) {
|
for (let dup = 0; dup < 1 + duplicateTiles; dup++) {
|
||||||
yield {
|
yield {
|
||||||
keys: [
|
keys: [
|
||||||
dup,
|
dup,
|
||||||
localUserMediaId,
|
localUserMediaId,
|
||||||
userId,
|
userId,
|
||||||
participant satisfies TaggedParticipant as TaggedParticipant, // Widen the type safely
|
participant satisfies TaggedParticipant as TaggedParticipant, // Widen the type safely
|
||||||
connection$,
|
connection$,
|
||||||
membership$.value,
|
membership$.value,
|
||||||
],
|
],
|
||||||
data: undefined,
|
data: undefined,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add remote members that are available
|
// add remote members that are available
|
||||||
@@ -748,8 +746,8 @@ export function createCallViewModel$(
|
|||||||
membership$,
|
membership$,
|
||||||
} of matrixLivekitMembers.value) {
|
} of matrixLivekitMembers.value) {
|
||||||
const userMediaId = `${userId}:${membership$.value.deviceId}`;
|
const userMediaId = `${userId}:${membership$.value.deviceId}`;
|
||||||
|
// skip local user as we added them manually before
|
||||||
if (userMediaId === localUserMediaId) continue;
|
if (userMediaId === localUserMediaId) continue;
|
||||||
// const participantId = membership$.value?.identity;
|
|
||||||
for (let dup = 0; dup < 1 + duplicateTiles; dup++) {
|
for (let dup = 0; dup < 1 + duplicateTiles; dup++) {
|
||||||
yield {
|
yield {
|
||||||
keys: [
|
keys: [
|
||||||
@@ -769,7 +767,7 @@ export function createCallViewModel$(
|
|||||||
scope,
|
scope,
|
||||||
_data$,
|
_data$,
|
||||||
dup,
|
dup,
|
||||||
participantId,
|
userMediaId,
|
||||||
userId,
|
userId,
|
||||||
participant,
|
participant,
|
||||||
connection$,
|
connection$,
|
||||||
@@ -789,7 +787,7 @@ export function createCallViewModel$(
|
|||||||
|
|
||||||
return new UserMedia(
|
return new UserMedia(
|
||||||
scope,
|
scope,
|
||||||
`${participantId}:${dup}`,
|
`${userMediaId}:${dup}`,
|
||||||
userId,
|
userId,
|
||||||
membership,
|
membership,
|
||||||
participant,
|
participant,
|
||||||
@@ -800,8 +798,8 @@ export function createCallViewModel$(
|
|||||||
localMembership.reconnecting$,
|
localMembership.reconnecting$,
|
||||||
displayName$,
|
displayName$,
|
||||||
matrixMemberMetadataStore.createAvatarUrlBehavior$(userId),
|
matrixMemberMetadataStore.createAvatarUrlBehavior$(userId),
|
||||||
handsRaised$.pipe(map((v) => v[participantId]?.time ?? null)),
|
handsRaised$.pipe(map((v) => v[userMediaId]?.time ?? null)),
|
||||||
reactions$.pipe(map((v) => v[participantId] ?? undefined)),
|
reactions$.pipe(map((v) => v[userMediaId] ?? undefined)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export function createMatrixLivekitMembers$({
|
|||||||
filter((values) =>
|
filter((values) =>
|
||||||
values.every((value) => value.epoch === values[0].epoch),
|
values.every((value) => value.epoch === values[0].epoch),
|
||||||
),
|
),
|
||||||
map(([x, y]) => new Epoch([x.value, y.value] as const, x.epoch)),
|
map(([ms, data]) => new Epoch([ms.value, data.value] as const, ms.epoch)),
|
||||||
generateItemsWithEpoch(
|
generateItemsWithEpoch(
|
||||||
// Generator function.
|
// Generator function.
|
||||||
// creates an array of `{key, data}[]`
|
// creates an array of `{key, data}[]`
|
||||||
|
|||||||
Reference in New Issue
Block a user