Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/msc3083_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ func checkRestrictedRoom(t *testing.T, alice *client.CSAPI, bob *client.CSAPI, s
// Leaving the room works and the user is unable to re-join.
bob.LeaveRoom(t, room)
bob.LeaveRoom(t, space)

// Wait until Alice sees Bob leave the space. This ensures that Alice's HS
// has processed the leave before Bob tries rejoining, so that it rejects his
// attempt to join the room.
alice.SyncUntilTimelineHas(t, space, func(ev gjson.Result) bool {
Copy link
Copy Markdown
Member

@kegsay kegsay Jul 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if having LeaveRoom is a mistake, and we should make a LeaveRoomSynced to do this always.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, though the subtlety here is that we need to wait for it to be processed on the remote server, rather than the local one.

Comment thread
erikjohnston marked this conversation as resolved.
if ev.Get("type").Str != "m.room.member" || ev.Get("sender").Str != bob.UserID {
return false
}

return ev.Get("content").Get("membership").Str == "leave"
})

failJoinRoom(t, bob, room, "hs1")

// Invite the user and joining should work.
Expand Down