diff --git a/lib/SyTest/Homeserver/Synapse.pm b/lib/SyTest/Homeserver/Synapse.pm index 513721fa2..e723af26e 100644 --- a/lib/SyTest/Homeserver/Synapse.pm +++ b/lib/SyTest/Homeserver/Synapse.pm @@ -1091,7 +1091,8 @@ sub generate_haproxy_map ^/_matrix/federation/v1/get_missing_events/ federation_reader ^/_matrix/federation/v1/publicRooms federation_reader -^/_matrix/client/(api/v1|r0)/publicRooms$ client_reader +^/_matrix/client/(api/v1|r0)/publicRooms$ client_reader +^/_matrix/client/(api/v1|r0)/rooms/.*/messages$ client_reader ^/_matrix/client/(r0|unstable|v2_alpha)/user_directory/ user_dir diff --git a/tests/30rooms/04messages.pl b/tests/30rooms/04messages.pl index 3e2f37850..99ebaa22b 100644 --- a/tests/30rooms/04messages.pl +++ b/tests/30rooms/04messages.pl @@ -352,3 +352,39 @@ }) }); }; + + +test "/messages does not require a from param", + requires => [ magic_local_user_and_room_fixtures() ], + + proves => [qw( can_paginate_room )], + + do => sub { + my ( $user, $room_id ) = @_; + + ( repeat { + matrix_send_room_text_message( $user, $room_id, + body => "Message number $_[0]" + ) + } foreach => [ 1 .. 5 ] )->then( sub { + do_request_json_for( $user, + method => "GET", + uri => "/r0/rooms/$room_id/messages", + params => { + dir => "b", + }, + ); + })->then( sub { + my ( $body ) = @_; + log_if_fail "First messages body", $body; + + my $chunk = $body->{chunk}; + @$chunk > 0 or + die "Expected messages"; + + assert_eq( $chunk->[0]{content}{body}, "Message number 5", + 'chunk[0] content body' ); + + Future->done(1); + }); + };