@@ -13,6 +13,7 @@ import (
13
13
"github.com/tidwall/gjson"
14
14
15
15
"github.com/matrix-org/complement/client"
16
+ "github.com/matrix-org/complement/federation"
16
17
"github.com/matrix-org/complement/helpers"
17
18
"github.com/matrix-org/complement/match"
18
19
"github.com/matrix-org/complement/must"
@@ -99,7 +100,7 @@ func TestFederationRoomsInvite(t *testing.T) {
99
100
verifyState (t , res , wantFields , wantValues , roomID , alice )
100
101
})
101
102
102
- t .Run ("Remote invited user can join the room when homeserver is already participating in the room" , func (t * testing.T ) {
103
+ t .Run ("Remote invited user can join the room when homeserver is already participating in the room (e2e) " , func (t * testing.T ) {
103
104
t .Parallel ()
104
105
roomID := alice .MustCreateRoom (t , map [string ]interface {}{
105
106
"preset" : "private_chat" ,
@@ -121,7 +122,7 @@ func TestFederationRoomsInvite(t *testing.T) {
121
122
alice .MustSyncUntil (t , client.SyncReq {}, client .SyncJoinedTo (bob2 .UserID , roomID ))
122
123
})
123
124
124
- t .Run ("Remote invited user can reject invite when homeserver is already participating in the room" , func (t * testing.T ) {
125
+ t .Run ("Remote invited user can reject invite when homeserver is already participating in the room (e2e) " , func (t * testing.T ) {
125
126
t .Parallel ()
126
127
roomID := alice .MustCreateRoom (t , map [string ]interface {}{
127
128
"preset" : "private_chat" ,
@@ -143,6 +144,44 @@ func TestFederationRoomsInvite(t *testing.T) {
143
144
alice .MustSyncUntil (t , client.SyncReq {Filter : includeLeaveSyncFilter }, client .SyncLeftFrom (bob2 .UserID , roomID ))
144
145
})
145
146
147
+ // Engineered condition where we only send `/invite` requests over federation and do
148
+ // not send the event in a `/send` transaction. Regression tests for
149
+ // https://github.com/element-hq/synapse/pull/18075
150
+ t .Run ("Remote invited user can join the room when homeserver is already participating in the room (engineered)" , func (t * testing.T ) {
151
+ t .Parallel ()
152
+
153
+ srv := federation .NewServer (t , deployment ,
154
+ federation .HandleKeyRequests (),
155
+ // bob1 will use this to join the remote room
156
+ federation .HandleMakeSendJoinRequests (),
157
+ )
158
+ cancel := srv .Listen ()
159
+ defer cancel ()
160
+
161
+ engineeredAliceUserId := srv .UserID ("alice" )
162
+
163
+ roomVersion := alice .GetDefaultRoomVersion (t )
164
+ initalEvents := federation .InitialRoomEvents (roomVersion , engineeredAliceUserId )
165
+ serverRoom := srv .MustMakeRoom (t , roomVersion , initalEvents )
166
+ roomID := serverRoom .RoomID
167
+
168
+ // bob1 is invited and can join the room (hs2 is now participating of the room)
169
+ //
170
+ // alice.MustInviteRoom(t, roomID, bob.UserID)
171
+ srv .MustInviteRoom (t , deployment , "hs1" , roomID , engineeredAliceUserId , bob .UserID )
172
+ bob .MustSyncUntil (t , client.SyncReq {}, client .SyncInvitedTo (bob .UserID , roomID ))
173
+ bob .MustJoinRoom (t , roomID , []string {srv .ServerName ()})
174
+ // Make sure alice can see bob in the room
175
+ // alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob.UserID, roomID))
176
+
177
+ // bob2 is invited and can also join the room
178
+ // alice.MustInviteRoom(t, roomID, bob2.UserID)
179
+ // bob2.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob2.UserID, roomID))
180
+ // bob2.MustJoinRoom(t, roomID, []string{srv.ServerName()})
181
+ // // Make sure alice can see bob2 in the room
182
+ // alice.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(bob2.UserID, roomID))
183
+ })
184
+
146
185
t .Run ("Invited user has 'is_direct' flag in prev_content after joining" , func (t * testing.T ) {
147
186
roomID := alice .MustCreateRoom (t , map [string ]interface {}{
148
187
"preset" : "private_chat" ,
0 commit comments