Skip to content

Commit d9be56c

Browse files
authored
Test that can reject federated invites (#1239)
1 parent 134bc3e commit d9be56c

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

tests/30rooms/06invite.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ sub inviteonly_room_fixture
2828
)
2929
}
3030

31+
push our @EXPORT, qw( inviteonly_room_fixture );
32+
3133
multi_test "Can invite users to invite-only rooms",
3234
# TODO: deprecated endpoint used in this test
3335
requires => do {

tests/31sync/15lazy-members.pl

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,3 +807,51 @@ sub check_filler_event {
807807
Future->done(1);
808808
});
809809
};
810+
811+
812+
test "Rejecting invite over federation doesn't break incremental /sync",
813+
requires => [ remote_user_fixture(),
814+
do {
815+
my $creator = local_user_fixture();
816+
$creator, inviteonly_room_fixture( creator => $creator );
817+
}
818+
],
819+
820+
check => sub {
821+
my ( $invitee, $creator, $room_id ) = @_;
822+
823+
my ( $filter_id );
824+
825+
matrix_create_filter( $invitee, {
826+
room => {
827+
state => {
828+
lazy_load_members => JSON::true,
829+
include_redundant_members => JSON::true,
830+
},
831+
timeline => {
832+
limit => 10
833+
},
834+
}
835+
})->then( sub {
836+
( $filter_id ) = @_;
837+
838+
matrix_sync( $invitee, filter => $filter_id )
839+
})->then( sub {
840+
matrix_invite_user_to_room_synced( $creator, $invitee, $room_id )
841+
})->then( sub {
842+
matrix_leave_room_synced( $invitee, $room_id )
843+
})->then( sub {
844+
matrix_sync_again( $invitee, filter => $filter_id )
845+
})->then( sub {
846+
my ( $body ) = @_;
847+
848+
# Check that invitee no longer sees the invite
849+
850+
if( exists $body->{rooms} and exists $body->{rooms}{invite} ) {
851+
assert_json_object( $body->{rooms}{invite} );
852+
keys %{ $body->{rooms}{invite} } and die "Expected empty dictionary";
853+
}
854+
855+
Future->done( 1 );
856+
});
857+
};

0 commit comments

Comments
 (0)