From 66f76bce33ad4faa882ee5918bb9adee8bfc8cc7 Mon Sep 17 00:00:00 2001 From: spencrmartin Date: Mon, 17 Nov 2025 13:28:50 -0500 Subject: [PATCH] Fix Matrix chat invite error by exposing inviteToRoom in MatrixContext - Add inviteToRoom to MatrixContextType interface - Create wrapper function for matrixService.inviteToRoom - Expose inviteToRoom in contextValue object - Fixes 'TypeError: inviteToRoom is not a function' error when inviting users to existing Matrix chats - Resolves issue in useSessionSharing.ts where inviteToRoom was undefined --- ui/desktop/src/contexts/MatrixContext.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ui/desktop/src/contexts/MatrixContext.tsx b/ui/desktop/src/contexts/MatrixContext.tsx index a86ba96e37..ce7f6039e9 100644 --- a/ui/desktop/src/contexts/MatrixContext.tsx +++ b/ui/desktop/src/contexts/MatrixContext.tsx @@ -20,6 +20,7 @@ interface MatrixContextType { addFriend: (userId: string) => Promise; createAISession: (name: string, inviteUserIds?: string[]) => Promise; joinRoom: (roomId: string) => Promise; + inviteToRoom: (roomId: string, userId: string) => Promise; sendMessage: (roomId: string, message: string) => Promise; sendAIPrompt: (roomId: string, prompt: string, sessionId: string, model?: string) => Promise; setAvatar: (file: File) => Promise; @@ -204,6 +205,11 @@ export const MatrixProvider: React.FC = ({ children, matrix // Data will be updated via the membershipChange event }; + const inviteToRoom = async (roomId: string, userId: string) => { + await matrixService.inviteToRoom(roomId, userId); + // Data will be updated via the membershipChange event + }; + const sendMessage = async (roomId: string, message: string) => { await matrixService.sendMessage(roomId, message); }; @@ -331,6 +337,7 @@ export const MatrixProvider: React.FC = ({ children, matrix addFriend, createAISession, joinRoom, + inviteToRoom, sendMessage, sendAIPrompt, setAvatar,