File tree Expand file tree Collapse file tree 5 files changed +7
-14
lines changed
apps/meteor/server/services/room
ee/packages/federation-matrix
packages/core-services/src/types Expand file tree Collapse file tree 5 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import { removeRoomOwner } from '../../methods/removeRoomOwner';
3636export class RoomService extends ServiceClassInternal implements IRoomService {
3737 protected name = 'room' ;
3838
39- async updateDirectMessageRoomName ( room : IRoom ) : Promise < boolean > {
39+ async updateDirectMessageRoomName ( room : IRoom , ignoreStatusFromSubs ?: string [ ] ) : Promise < boolean > {
4040 const subs = await Subscriptions . findByRoomId ( room . _id , { projection : { u : 1 , status : 1 } } ) . toArray ( ) ;
4141
4242 const uids = subs . map ( ( sub ) => sub . u . _id ) ;
@@ -47,7 +47,7 @@ export class RoomService extends ServiceClassInternal implements IRoomService {
4747
4848 for await ( const sub of subs ) {
4949 // don't update the name if the user is invited but hasn't accepted yet
50- if ( sub . status === 'INVITED' ) {
50+ if ( ! ignoreStatusFromSubs ?. includes ( sub . _id ) && sub . status === 'INVITED' ) {
5151 continue ;
5252 }
5353 await Subscriptions . updateOne ( { _id : sub . _id } , { $set : roomNames [ sub . u . _id ] } ) ;
Original file line number Diff line number Diff line change @@ -291,13 +291,9 @@ export class FederationMatrix extends ServiceClass implements IFederationMatrixS
291291 continue ;
292292 }
293293
294- if ( ! isUserNativeFederated ( member ) ) {
295- continue ;
296- }
297-
298294 try {
299295 await federationSDK . inviteUserToRoom (
300- userIdSchema . parse ( member . username ) ,
296+ isUserNativeFederated ( member ) ? userIdSchema . parse ( member . username ) : `@ ${ member . username } : ${ this . serverName } ` ,
301297 roomIdSchema . parse ( matrixRoomResult . room_id ) ,
302298 userIdSchema . parse ( actualMatrixUserId ) ,
303299 ) ;
@@ -919,8 +915,6 @@ export class FederationMatrix extends ServiceClass implements IFederationMatrixS
919915
920916 if ( action === 'accept' ) {
921917 await federationSDK . acceptInvite ( room . federation . mrid , matrixUserId ) ;
922-
923- await Room . performAcceptRoomInvite ( room , subscription , user ) ;
924918 }
925919
926920 if ( action === 'reject' ) {
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ async function handleJoin({
215215
216216 // update room name for DMs
217217 if ( room . t === 'd' ) {
218- await Room . updateDirectMessageRoomName ( room ) ;
218+ await Room . updateDirectMessageRoomName ( room , [ subscription . _id ] ) ;
219219 }
220220
221221 if ( ! subscription . status ) {
Original file line number Diff line number Diff line change @@ -1097,7 +1097,7 @@ const waitForRoomEvent = async (
10971097 } ) ;
10981098 } ) ;
10991099
1100- it . failing ( 'should accept the invitation by the Rocket.Chat user' , async ( ) => {
1100+ it ( 'should accept the invitation by the Rocket.Chat user' , async ( ) => {
11011101 const response = await acceptRoomInvite ( rcRoom . _id , rcUserConfig2 ) ;
11021102 expect ( response . success ) . toBe ( true ) ;
11031103 } ) ;
@@ -1435,7 +1435,7 @@ const waitForRoomEvent = async (
14351435 } ) ;
14361436 } ) ;
14371437
1438- it . failing ( 'should create a federated DM between rcUser1 and rcUser2 and the Synapse user' , async ( ) => {
1438+ it ( 'should create a federated DM between rcUser1 and rcUser2 and the Synapse user' , async ( ) => {
14391439 const fedDmResponse = await rcUser1 . config . request
14401440 . post ( api ( 'dm.create' ) )
14411441 . set ( rcUser1 . config . credentials )
@@ -1486,7 +1486,6 @@ const waitForRoomEvent = async (
14861486 { delayMs : 100 } ,
14871487 ) ;
14881488
1489- // TODO accept not working
14901489 const response = await acceptRoomInvite ( rcRoom . _id , rcUser2 . config ) ;
14911490 expect ( response . success ) . toBe ( true ) ;
14921491 } ) ;
Original file line number Diff line number Diff line change @@ -69,5 +69,5 @@ export interface IRoomService {
6969 status ?: 'INVITED' ;
7070 roles ?: ISubscription [ 'roles' ] ;
7171 } ) : Promise < string | undefined > ;
72- updateDirectMessageRoomName ( room : IRoom ) : Promise < boolean > ;
72+ updateDirectMessageRoomName ( room : IRoom , ignoreStatusFromSubs ?: string [ ] ) : Promise < boolean > ;
7373}
You can’t perform that action at this time.
0 commit comments