Bump matrix js sdk version (#1054)

<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

<!-- Please include a summary of the change. Please also include
relevant motivation and context. List any dependencies that are required
for this change. -->

Seems to work fine, used a few comments to disable anys that should
probably not be anys but im lazy atm

#### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings

### AI disclosure:

- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
This commit is contained in:
7w1 authored and GitHub committed 2026-07-11 15:37:41 -05:00
commit dc150da77f
16 files changed
+93 -140

No files matched your search

+1 -1
View File
@@ -71,7 +71,7 @@
"linkify-react": "^4.3.3",
"linkifyjs": "^4.3.3",
"marked": "^18.0.5",
"matrix-js-sdk": "^38.4.0",
"matrix-js-sdk": "^41.9.0",
"matrix-widget-api": "^1.17.0",
"pdfjs-dist": "^6.1.200",
"react": "^18.3.1",
+29 -31
View File
@@ -147,8 +147,8 @@ importers:
specifier: ^18.0.5
version: 18.0.5
matrix-js-sdk:
specifier: ^38.4.0
version: 38.4.0
specifier: ^41.9.0
version: 41.9.0
matrix-widget-api:
specifier: ^1.17.0
version: 1.17.0
@@ -861,6 +861,9 @@ packages:
resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==}
engines: {node: '>=6.9.0'}
'@babel/[email protected]':
resolution: {integrity: sha512-sL6cvO2IfkSu/iU+zs2S/w01B7A8V7suXSIKEN4hPFFdZoiPGxrj5pAG0lCaqLWiEIrjKzdznIWuaLcxPR53qw==}
'@babel/[email protected]':
resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==}
engines: {node: '>=6.9.0'}
@@ -1521,8 +1524,8 @@ packages:
'@juggle/[email protected]':
resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==}
'@matrix-org/matrix-sdk-crypto-wasm@15.3.0':
resolution: {integrity: sha512-QyxHvncvkl7nf+tnn92PjQ54gMNV8hMSpiukiDgNrqF6IYwgySTlcSdkPYdw8QjZJ0NR6fnVrNzMec0OohM3wA==}
'@matrix-org/matrix-sdk-crypto-wasm@18.3.1':
resolution: {integrity: sha512-VRjWhE1UgHnPpJ3b9B5+8z71ZC/HICFngPPFIN6ktzmUBKI5RusPujzbAQUoB3CgZ0yU58L99AfSQS4YTztSWw==}
engines: {node: '>= 18'}
'@napi-rs/[email protected]':
@@ -3184,9 +3187,9 @@ packages:
[email protected]:
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
content-type@1.0.5:
resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
engines: {node: '>= 0.6'}
content-type@2.0.0:
resolution: {integrity: sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ==}
engines: {node: '>=18'}
[email protected]:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
@@ -4107,8 +4110,8 @@ packages:
[email protected]:
resolution: {integrity: sha512-1QEOsXO+bhyCroIe2/A5OwaxHvBm7EsSQ46DEDn8RBIfQwN5HWBpFvyWWR4QY0KHPPnnJdI99wgRiAl7Ad5qaA==}
matrix-js-sdk@38.4.0:
resolution: {integrity: sha512-Xs9/6pE1eL/F5bP11jrtsZXiPlCda+mW5UC21DifvpjHWvAZsz4rq24rXd4s5/oPrIZKJqP8Fnfcic870ben2w==}
matrix-js-sdk@41.9.0:
resolution: {integrity: sha512-xRoaIxu8e7ECV8ctT+gxXvOA+KqPJdellihIeM7rZ5LPl9ZWMct+ltN/Z4f76PJtAazjIXd8A3edPu6OSKk9/g==}
engines: {node: '>=22.0.0'}
[email protected]:
@@ -4262,9 +4265,9 @@ packages:
resolution: {integrity: sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==}
engines: {node: '>=18'}
p-retry@7.1.1:
resolution: {integrity: sha512-J5ApzjyRkkf601HpEeykoiCvzHQjWxPAHhyjFcEUP2SWq0+35NKh8TLhpLw+Dkq5TZBFvUM6UigdE9hIVYTl5w==}
engines: {node: '>=20'}
p-retry@8.0.0:
resolution: {integrity: sha512-kFVqH1HxOHp8LupNsOys7bSV09VYTRLxarH/mokO4Rqhk6wGi70E0jh4VzvVGXfEVNggHoHLAMWsQqHyU1Ey9A==}
engines: {node: '>=22'}
[email protected]:
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
@@ -4553,8 +4556,8 @@ packages:
[email protected]:
resolution: {integrity: sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ==}
sdp-transform@2.15.0:
resolution: {integrity: sha512-KrOH82c/W+GYQ0LHqtr3caRpM3ITglq3ljGUIb8LTki7ByacJZ9z+piSGiwZDsRyhQbYBOBJgr2k6X4BZXi3Kw==}
sdp-transform@3.0.0:
resolution: {integrity: sha512-gfYVRGxjHkGF2NPeUWHw5u6T/KGFtS5/drPms73gaSuMaVHKCY3lpLnGDfswVQO0kddeePoti09AwhYP4zA8dQ==}
hasBin: true
[email protected]:
@@ -4911,10 +4914,6 @@ packages:
deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).
hasBin: true
[email protected]:
resolution: {integrity: sha512-vzi9uRZ926x4XV73S/4qQaTwPXM2JBj6/6lI/byHH1jOpCzb0zDbfytgA9LcN/hzb2l7WQSQnxITOVx5un/wGw==}
hasBin: true
[email protected]:
resolution: {integrity: sha512-aEp3+6cmIRjHUlQnWdgGXYMYtrIG26QnN9jJDZEE5LRhvo1Z9HzoJwLDgyVULUPWcSdCnZAroQm7raXJyTG0AA==}
peerDependencies:
@@ -5976,6 +5975,8 @@ snapshots:
'@babel/[email protected]': {}
'@babel/[email protected]': {}
'@babel/[email protected]':
dependencies:
'@babel/code-frame': 7.29.7
@@ -6421,7 +6422,7 @@ snapshots:
'@juggle/[email protected]': {}
'@matrix-org/matrix-sdk-crypto-wasm@15.3.0': {}
'@matrix-org/matrix-sdk-crypto-wasm@18.3.1': {}
'@napi-rs/[email protected]':
optional: true
@@ -7764,7 +7765,7 @@ snapshots:
[email protected]: {}
content-type@1.0.5: {}
content-type@2.0.0: {}
[email protected]: {}
@@ -8730,22 +8731,21 @@ snapshots:
[email protected]: {}
matrix-js-sdk@38.4.0:
matrix-js-sdk@41.9.0:
dependencies:
'@babel/runtime': 7.29.7
'@matrix-org/matrix-sdk-crypto-wasm': 15.3.0
'@babel/runtime': 8.0.0
'@matrix-org/matrix-sdk-crypto-wasm': 18.3.1
another-json: 0.2.0
bs58: 6.0.0
content-type: 1.0.5
content-type: 2.0.0
jwt-decode: 4.0.0
loglevel: 1.9.2
matrix-events-sdk: 0.0.1
matrix-widget-api: 1.17.0
oidc-client-ts: 3.5.0
p-retry: 7.1.1
sdp-transform: 2.15.0
p-retry: 8.0.0
sdp-transform: 3.0.0
unhomoglyph: 1.0.6
uuid: 13.0.2
[email protected]:
dependencies:
@@ -8956,7 +8956,7 @@ snapshots:
[email protected]: {}
p-retry@7.1.1:
p-retry@8.0.0:
dependencies:
is-network-error: 1.3.2
@@ -9299,7 +9299,7 @@ snapshots:
dependencies:
compute-scroll-into-view: 3.1.1
sdp-transform@2.15.0: {}
sdp-transform@3.0.0: {}
[email protected]: {}
@@ -9704,8 +9704,6 @@ snapshots:
[email protected]: {}
[email protected]: {}
[email protected]([email protected]([email protected]))([email protected]):
optionalDependencies:
react: 18.3.1
+2 -2
View File
@@ -1,5 +1,5 @@
import { Box, Chip, Text, as, color, toRem } from 'folds';
import type { EventTimelineSet, IMentions, Room, SessionMembershipData } from '$types/matrix-sdk';
import type { EventTimelineSet, IMentions, Room } from '$types/matrix-sdk';
import { EventType, MsgType } from '$types/matrix-sdk';
import type { MouseEventHandler, ReactNode } from 'react';
import { useCallback, useMemo } from 'react';
@@ -403,7 +403,7 @@ export const Reply = as<'div', ReplyProps>(
image = timelineIcon(Hash);
bodyJSX = ' changed room avatar';
} else if (eventType === EventType.GroupCallMemberPrefix && !!replyEvent) {
const callJoined = replyEvent.getContent<SessionMembershipData>().application;
const callJoined = replyEvent.getContent<Record<string, unknown>>().application;
image = callJoined ? timelineIcon(Phone) : timelineIcon(PhoneDisconnect);
bodyJSX = callJoined ? ' joined the call' : ' ended the call';
} else if (eventType === EventType.RoomRedaction && replyEvent) {
+2 -2
View File
@@ -1,4 +1,4 @@
import type { CallMembership, SessionMembershipData } from '$types/matrix-sdk';
import type { CallMembership } from '$types/matrix-sdk';
import { useState } from 'react';
import { Avatar, Box, Text } from 'folds';
import {
@@ -20,7 +20,7 @@ import { getMouseEventCords } from '../../utils/dom';
import * as css from './styles.css';
interface MemberWithMembershipData {
membershipData?: SessionMembershipData & {
membershipData?: Record<string, unknown> & {
'm.call.intent': 'video' | 'audio';
};
}
@@ -1,53 +1,37 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { Room } from '$types/matrix-sdk';
import { MatrixRTCSession } from '$types/matrix-sdk';
import { describe, expect, it } from 'vitest';
import {
getCallMembershipPresence,
isCallActive,
isIncomingCallActive,
isOutgoingCallPending,
type SessionDescription,
} from './callMembershipState';
const MY_USER_ID = '@self:example.org';
const SESSION_DESCRIPTION = {} as SessionDescription;
const room = { roomId: '!room:example.org' } as unknown as Room;
describe('callMembershipState', () => {
afterEach(() => {
vi.restoreAllMocks();
});
it('detects incoming call when remote members exist without self', () => {
vi.spyOn(MatrixRTCSession, 'sessionMembershipsForRoom').mockReturnValue([
{ userId: '@remote:example.org' },
] as never);
const memberships = [{ userId: '@remote:example.org' }];
expect(isIncomingCallActive(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(true);
expect(isCallActive(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(false);
expect(isOutgoingCallPending(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(false);
expect(isIncomingCallActive(MY_USER_ID, memberships)).toBe(true);
expect(isCallActive(MY_USER_ID, memberships)).toBe(false);
expect(isOutgoingCallPending(MY_USER_ID, memberships)).toBe(false);
});
it('detects active call when self and remote members exist', () => {
vi.spyOn(MatrixRTCSession, 'sessionMembershipsForRoom').mockReturnValue([
{ userId: MY_USER_ID },
{ userId: '@remote:example.org' },
] as never);
const memberships = [{ userId: MY_USER_ID }, { userId: '@remote:example.org' }];
expect(isIncomingCallActive(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(false);
expect(isCallActive(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(true);
expect(isOutgoingCallPending(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(false);
expect(isIncomingCallActive(MY_USER_ID, memberships)).toBe(false);
expect(isCallActive(MY_USER_ID, memberships)).toBe(true);
expect(isOutgoingCallPending(MY_USER_ID, memberships)).toBe(false);
});
it('detects pending outgoing call when only self is present', () => {
vi.spyOn(MatrixRTCSession, 'sessionMembershipsForRoom').mockReturnValue([
{ userId: MY_USER_ID },
] as never);
const memberships = [{ userId: MY_USER_ID }];
expect(getCallMembershipPresence(MY_USER_ID, room, SESSION_DESCRIPTION)).toEqual({
expect(getCallMembershipPresence(MY_USER_ID, memberships)).toEqual({
hasSelfMember: true,
remoteMemberCount: 0,
});
expect(isOutgoingCallPending(MY_USER_ID, room, SESSION_DESCRIPTION)).toBe(true);
expect(isOutgoingCallPending(MY_USER_ID, memberships)).toBe(true);
});
});
+8 -44
View File
@@ -1,8 +1,3 @@
import { MatrixRTCSession } from '$types/matrix-sdk';
import type { Room } from '$types/matrix-sdk';
export type SessionDescription = Parameters<typeof MatrixRTCSession.sessionMembershipsForRoom>[1];
type RtcMembership = { userId?: string; sender?: string };
export type CallMembershipPresence = {
@@ -10,15 +5,10 @@ export type CallMembershipPresence = {
remoteMemberCount: number;
};
const getRoomMemberships = (room: Room, sessionDescription: SessionDescription) =>
MatrixRTCSession.sessionMembershipsForRoom(room, sessionDescription) as RtcMembership[];
export const getCallMembershipPresence = (
mxUserId: string,
room: Room,
sessionDescription: SessionDescription
memberships: RtcMembership[]
): CallMembershipPresence => {
const memberships = getRoomMemberships(room, sessionDescription);
const remoteMemberCount = memberships.filter(
(membership) => (membership.userId || membership.sender) !== mxUserId
).length;
@@ -29,54 +19,28 @@ export const getCallMembershipPresence = (
return { hasSelfMember, remoteMemberCount };
};
export const isIncomingCallActive = (
mxUserId: string,
room: Room,
sessionDescription: SessionDescription
): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(
mxUserId,
room,
sessionDescription
);
export const isIncomingCallActive = (mxUserId: string, memberships: RtcMembership[]): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(mxUserId, memberships);
return remoteMemberCount > 0 && !hasSelfMember;
};
export const isCallActive = (
mxUserId: string,
room: Room,
sessionDescription: SessionDescription
): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(
mxUserId,
room,
sessionDescription
);
export const isCallActive = (mxUserId: string, memberships: RtcMembership[]): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(mxUserId, memberships);
return hasSelfMember && remoteMemberCount > 0;
};
export const isOutgoingCallPending = (
mxUserId: string,
room: Room,
sessionDescription: SessionDescription
): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(
mxUserId,
room,
sessionDescription
);
export const isOutgoingCallPending = (mxUserId: string, memberships: RtcMembership[]): boolean => {
const { hasSelfMember, remoteMemberCount } = getCallMembershipPresence(mxUserId, memberships);
return hasSelfMember && remoteMemberCount === 0;
};
export const getRemoteRtcMemberUserIds = (
mxUserId: string,
room: Room,
sessionDescription: SessionDescription
memberships: RtcMembership[]
): Set<string> => {
const memberships = getRoomMemberships(room, sessionDescription);
return new Set(
memberships
.map((membership) => membership.userId || membership.sender)
@@ -1,11 +1,11 @@
import { describe, expect, it } from 'vitest';
import type { IncomingCall } from '$state/callEmbed';
import { evaluateIncomingCallFallback } from './callSignalingFallback';
import type { SessionDescription } from './callMembershipState';
import { INCOMING_MEMBERSHIP_GRACE_MS } from './callSignalingPolicy';
const NOW = 1_700_000_000_000;
const EMPTY_SESSION = {} as SessionDescription;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const EMPTY_SESSION_MEMBERSHIPS: any[] = [];
const incomingCall: IncomingCall = {
roomId: '!room:example.org',
@@ -25,7 +25,7 @@ describe('evaluateIncomingCallFallback', () => {
evaluateIncomingCallFallback({ ...incomingCall, expiresAt: NOW - 1 }, NOW, {
myUserId: '@self:example.org',
getRoom: () => null,
getSessionDescription: () => EMPTY_SESSION,
getSessionMemberships: () => EMPTY_SESSION_MEMBERSHIPS,
})
).toEqual({ kind: 'clear', reason: 'expired' });
});
@@ -35,7 +35,7 @@ describe('evaluateIncomingCallFallback', () => {
evaluateIncomingCallFallback(incomingCall, NOW, {
myUserId: '@self:example.org',
getRoom: () => ({ roomId: incomingCall.roomId }) as never,
getSessionDescription: () => EMPTY_SESSION,
getSessionMemberships: () => EMPTY_SESSION_MEMBERSHIPS,
isIncomingActive: () => false,
})
).toEqual({ kind: 'none' });
@@ -48,7 +48,7 @@ describe('evaluateIncomingCallFallback', () => {
{
myUserId: '@self:example.org',
getRoom: () => ({ roomId: incomingCall.roomId }) as never,
getSessionDescription: () => EMPTY_SESSION,
getSessionMemberships: () => EMPTY_SESSION_MEMBERSHIPS,
isIncomingActive: () => false,
}
);
@@ -1,6 +1,6 @@
import type { IncomingCall } from '$state/callEmbed';
import type { Room } from '$types/matrix-sdk';
import type { SessionDescription } from './callMembershipState';
import { isIncomingCallActive } from './callMembershipState';
import { INCOMING_MEMBERSHIP_GRACE_MS } from './callSignalingPolicy';
@@ -11,7 +11,7 @@ export type IncomingFallbackAction =
export type IncomingFallbackContext = {
myUserId: string;
getRoom: (roomId: string) => Room | null | undefined;
getSessionDescription: (room: Room) => SessionDescription;
getSessionMemberships: (room: Room) => { userId?: string; sender?: string }[];
isIncomingActive?: typeof isIncomingCallActive;
};
@@ -26,9 +26,9 @@ export const evaluateIncomingCallFallback = (
const incomingRoom = context.getRoom(incoming.roomId);
if (!incomingRoom) return { kind: 'clear', reason: 'missing_room' };
const sessionDescription = context.getSessionDescription(incomingRoom);
const memberships = context.getSessionMemberships(incomingRoom);
const isIncomingActive = context.isIncomingActive ?? isIncomingCallActive;
if (isIncomingActive(context.myUserId, incomingRoom, sessionDescription)) {
if (isIncomingActive(context.myUserId, memberships)) {
return { kind: 'none' };
}
@@ -166,7 +166,8 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
const submitAccountData: AccountDataSubmitCallback = useCallback(
async (type, content) => {
await mx.setRoomAccountData(room.roomId, type, content);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await mx.setRoomAccountData(room.roomId, type as any, content);
},
[mx, room.roomId]
);
+2 -1
View File
@@ -577,7 +577,8 @@ export function RoomViewHeader({ callView }: Readonly<{ callView?: boolean }>) {
if (pinnedIds.length === 0) return;
const hash = await getPinsHash(pinnedIds);
await mx.setRoomAccountData(room.roomId, CustomAccountDataEvent.SablePinStatus, {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
await mx.setRoomAccountData(room.roomId, CustomAccountDataEvent.SablePinStatus as any, {
hash,
count: pinnedIds.length,
last_seen_id: pinnedIds.at(-1),
@@ -48,8 +48,9 @@ export function ScheduledMessagesList({ room, onEditMessage }: ScheduledMessages
enabled: supported,
});
const roomEvents = data?.delayed_events.filter(
(evt) =>
const roomEvents = data?.scheduled?.filter(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(evt: any) =>
evt.room_id === room.roomId &&
(evt.type === 'm.room.message' || evt.type === 'm.room.encrypted')
);
@@ -87,7 +88,8 @@ export function ScheduledMessagesList({ room, onEditMessage }: ScheduledMessages
[setScheduledTime, setEditingDelayId]
);
const visibleEvents = roomEvents?.filter((e) => e.delay_id !== editingDelayId) ?? [];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const visibleEvents = roomEvents?.filter((e: any) => e.delay_id !== editingDelayId) ?? [];
if (!supported || visibleEvents.length === 0) {
return null;
@@ -110,7 +112,8 @@ export function ScheduledMessagesList({ room, onEditMessage }: ScheduledMessages
</Box>
{expanded && (
<Box direction="Column" className={css.ScheduledMessagesPanel}>
{visibleEvents.map((evt) => {
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
{visibleEvents.map((evt: any) => {
const deliveryTs = 'delay' in evt ? evt.running_since + evt.delay : evt.running_since;
const isEncryptedEvt = evt.type === 'm.room.encrypted';
const body =
@@ -12,7 +12,7 @@ import type {
} from '$types/matrix-sdk';
import type { IImageContent } from '$types/matrix/common';
import { NotificationCountType, RoomEvent, ThreadEvent, EventType } from '$types/matrix-sdk';
import type { SessionMembershipData } from '$types/matrix-sdk';
import type { HTMLReactParserOptions } from 'html-react-parser';
import type { Opts as LinkifyOpts } from 'linkifyjs';
import { Box, Chip, Avatar, Text, config, toRem } from 'folds';
@@ -1553,7 +1553,7 @@ export function useTimelineEventRenderer({
const senderId = mEvent.getSender() ?? '';
const senderName = getMemberDisplayName(room, senderId) || getMxIdLocalPart(senderId);
const content = mEvent.getContent() as SessionMembershipData;
const content = mEvent.getContent() as Record<string, unknown>;
const prevContent = mEvent.getPrevContent();
const callJoined = content.application;
+4 -4
View File
@@ -31,13 +31,13 @@ export const useCallSession = (room: Room): MatrixRTCSession => {
};
export const useCallMembers = (room: Room, session: MatrixRTCSession): CallMembership[] => {
const [memberships, setMemberships] = useState(
MatrixRTCSession.sessionMembershipsForRoom(room, session.sessionDescription)
);
const [memberships, setMemberships] = useState<CallMembership[]>([]);
useEffect(() => {
const updateMemberships = () => {
setMemberships(MatrixRTCSession.sessionMembershipsForRoom(room, session.sessionDescription));
MatrixRTCSession.sessionMembershipsForSlot(room, session.slotDescription).then(
setMemberships
);
};
updateMemberships();
+1 -3
View File
@@ -1,6 +1,5 @@
import type { RefObject } from 'react';
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
import { MatrixRTCSession } from '$types/matrix-sdk';
import type { MatrixClient, Room } from '$types/matrix-sdk';
import { useSetAtom } from 'jotai';
import * as Sentry from '@sentry/react';
@@ -49,8 +48,7 @@ export const createCallEmbed = (
elementCallUrl?: string
): CallEmbed => {
const rtcSession = mx.matrixRTC.getRoomSession(room);
const ongoing =
MatrixRTCSession.sessionMembershipsForRoom(room, rtcSession.sessionDescription).length > 0;
const ongoing = rtcSession.memberships.length > 0;
const intent = CallEmbed.getIntent(dm, ongoing, pref?.video);
const widget = CallEmbed.getWidget(mx, room, intent, themeKind, elementCallUrl);
+6 -6
View File
@@ -173,8 +173,8 @@ export function useIncomingCallSignaling() {
}
const myUserId = mx.getSafeUserId();
const sessionDescription = mx.matrixRTC.getRoomSession(outgoingRoom).sessionDescription;
let remoteJoinedIds = getRemoteRtcMemberUserIds(myUserId, outgoingRoom, sessionDescription);
const rtcSession = mx.matrixRTC.getRoomSession(outgoingRoom);
let remoteJoinedIds = getRemoteRtcMemberUserIds(myUserId, rtcSession.memberships);
if (remoteJoinedIds.size === 0) {
remoteJoinedIds = new Set([decline.senderId]);
}
@@ -466,7 +466,7 @@ export function useIncomingCallSignaling() {
const fallbackContext = {
myUserId,
getRoom: (roomId: string) => mx.getRoom(roomId),
getSessionDescription: (room: Room) => mx.matrixRTC.getRoomSession(room).sessionDescription,
getSessionMemberships: (room: Room) => mx.matrixRTC.getRoomSession(room).memberships,
};
const evaluateIncomingFallback = () => {
@@ -523,9 +523,9 @@ export function useIncomingCallSignaling() {
return stop();
}
const session = mx.matrixRTC.getRoomSession(outgoingRoom).sessionDescription;
const rtcSession = mx.matrixRTC.getRoomSession(outgoingRoom);
if (isCallActive(myUserId, outgoingRoom, session)) {
if (isCallActive(myUserId, rtcSession.memberships)) {
hasCallBeenActiveRef.current = true;
}
@@ -533,7 +533,7 @@ export function useIncomingCallSignaling() {
return stop();
}
const isPending = isOutgoingCallPending(myUserId, outgoingRoom, session);
const isPending = isOutgoingCallPending(myUserId, rtcSession.memberships);
if (!isPending) {
return stop();
}
+6 -2
View File
@@ -1437,7 +1437,11 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
sendFeedback('Encryption is not enabled on this client.', room, mx.getSafeUserId());
return;
}
crypto
(
crypto as unknown as {
shareRoomHistoryWithUser: (roomId: string, userId: string) => Promise<void>;
}
)
.shareRoomHistoryWithUser(roomId, targetUserId)
.then(() => {
sendFeedback(
@@ -1446,7 +1450,7 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
mx.getSafeUserId()
);
})
.catch((e) => {
.catch((e: Error) => {
sendFeedback(
`Failed to share E2EE history: ${(e as Error).message}`,
room,