From a3755c67daf3f973909110b747495f8fb4f0674b Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Mon, 14 Nov 2022 18:19:53 +0000 Subject: [PATCH] Add back the helper function --- tests/10apidoc/36room-levels.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/10apidoc/36room-levels.pl diff --git a/tests/10apidoc/36room-levels.pl b/tests/10apidoc/36room-levels.pl new file mode 100644 index 000000000..ce342fb6e --- /dev/null +++ b/tests/10apidoc/36room-levels.pl @@ -0,0 +1,20 @@ +# Tests migrated to Complement as of https://github.com/matrix-org/complement/pull/545 +# However this helper function is used in other tests. + +push our @EXPORT, qw( matrix_change_room_power_levels ); + +sub matrix_change_room_power_levels +{ + my ( $user, $room_id, $func ) = @_; + is_User( $user ) or croak "Expected a User; got $user"; + + matrix_get_room_state( $user, $room_id, type => "m.room.power_levels" ) + ->then( sub { + my ( $levels ) = @_; + $func->( $levels ); + + matrix_put_room_state_synced( $user, $room_id, type => "m.room.power_levels", + content => $levels, + ); + }); +}