From e96c7d7e057965347ff71907ff82c340dc4999e6 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 3 Mar 2022 14:11:59 +0000 Subject: [PATCH] Fix "inbound federation redacts events from erased users" Ensure the HS under test remains in the room so we can query the event which should be redacted. Fixes #1203. --- tests/50federation/32room-getevent.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/50federation/32room-getevent.pl b/tests/50federation/32room-getevent.pl index ab1fe5787..49d597daf 100644 --- a/tests/50federation/32room-getevent.pl +++ b/tests/50federation/32room-getevent.pl @@ -45,12 +45,22 @@ requires => [ $main::OUTBOUND_CLIENT, federated_rooms_fixture(), + local_user_fixture(), ], + # On the homeserver under test, have a user `creator` create a public room. + # A second user `remaining_user` on the same HS joins too. + # Sytest acts as a second homeserver and join a user (`user_id`) to that room. + # The `creator` sends a message, then requests deactivation with erasure. + # The homeserver under test should redact that event. Sytest confirms this by + # re-requesting that event. (The `remaining_user` ensures that the homeserver under + # test is still in the room.) + do => sub { - my ( $outbound_client, $creator, $user_id, $room ) = @_; + my ( $outbound_client, $creator, $user_id, $room, $remaining_user ) = @_; my $first_home_server = $creator->server_name; my $room_id = $room->room_id; + matrix_join_room($remaining_user, $room_id); my $message_id; @@ -79,7 +89,7 @@ # Check that the content is right assert_eq( $event->{content}->{body}, "body1" ); - # now do the erasure + # The `creator` requests that their account be deactivated. matrix_deactivate_account( $creator, erase => JSON::true ); })->then( sub { # re-fetch the event and check that it is redacted.