File tree Expand file tree Collapse file tree 2 files changed +188
-122
lines changed
ee/packages/federation-matrix/tests/end-to-end Expand file tree Collapse file tree 2 files changed +188
-122
lines changed Original file line number Diff line number Diff line change @@ -424,3 +424,32 @@ export const loadHistory = async (
424424 unreadNotLoaded ?: number ;
425425 } ;
426426} ;
427+
428+ /**
429+ * Accepts a room invite for the authenticated user.
430+ *
431+ * Processes a room invitation by accepting it, which grants the user
432+ * access to the room. This is essential for federated room workflows
433+ * where users receive invitations rather than auto-joining.
434+ *
435+ * @param roomId - The unique identifier of the room
436+ * @param config - Optional request configuration for custom domains
437+ * @returns Promise resolving to the acceptance response
438+ */
439+ export const acceptRoomInvite = ( roomId : IRoom [ '_id' ] , config ?: IRequestConfig ) => {
440+ const requestInstance = config ?. request || request ;
441+ const credentialsInstance = config ?. credentials || credentials ;
442+
443+ return new Promise < { success : boolean } > ( ( resolve ) => {
444+ void requestInstance
445+ . post ( api ( 'rooms.invite' ) )
446+ . set ( credentialsInstance )
447+ . send ( {
448+ roomId,
449+ action : 'accept' ,
450+ } )
451+ . end ( ( _err : any , req : any ) => {
452+ resolve ( req . body ) ;
453+ } ) ;
454+ } ) ;
455+ } ;
You can’t perform that action at this time.
0 commit comments