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
48 changes: 48 additions & 0 deletions tests/31sync/07invited.pl
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,51 @@
Future->done(1);
})
};


test "Newly joined room is included in an incremental sync after invite",
# matrix-org/synapse#4422
requires => [
local_user_and_room_fixtures(),
local_user_fixture( with_events => 0 ),
qw( can_sync ),
],

check => sub {
my ( $creator, $room_id, $user ) = @_;

matrix_sync( $user )->then( sub {
matrix_invite_user_to_room_synced(
$creator, $user, $room_id,
);
})->then( sub {
matrix_sync_again( $user );
})->then( sub {
my ( $body ) = @_;
log_if_fail "post-invite sync", $body;

my $room = $body->{rooms}{invite}{$room_id};
assert_json_keys( $room, qw( invite_state ) );
assert_json_keys( $room->{invite_state}, qw( events ) );

# accept the invite
matrix_join_room( $user, $room_id );
})->then( sub {
# wait for the sync to turn up
await_sync( $user,
check => sub {
return $_[0]->{rooms}{join}{$room_id};
},
);
})->then( sub {
my ( $room ) = @_;
log_if_fail "post-join sync", $room;

assert_json_keys( $room, qw( timeline state ephemeral ));
assert_json_keys( $room->{timeline}, qw( events limited prev_batch ));
assert_json_keys( $room->{state}, qw( events ));
assert_json_keys( $room->{ephemeral}, qw( events ));

Future->done(1);
})
};