summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-11-21 12:10:20 +0000
committerMatthew Hodgson <matthew@matrix.org>2017-11-21 12:10:20 +0000
commit3ab2cfec47be134451f8091c1379870ccb7eee26 (patch)
treeb2333a0e56d73e4f825f3a31b5e3480795aa80b3 /scripts
parentdon't double-invite in sync_room_to_group.pl (diff)
downloadsynapse-3ab2cfec47be134451f8091c1379870ccb7eee26.tar.xz
sanity checks
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sync_room_to_group.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/sync_room_to_group.pl b/scripts/sync_room_to_group.pl
index 92891f3d19..f0c2dfadfa 100755
--- a/scripts/sync_room_to_group.pl
+++ b/scripts/sync_room_to_group.pl
@@ -26,6 +26,9 @@ my $group_users = [
     (map { $_->{user_id} } @{decode_json($ua->get("${hs}/_matrix/client/unstable/groups/${group_id}/invited_users?access_token=${access_token}" )->decoded_content)->{chunk}}),
 ];
 
+die "refusing to sync from empty room" unless (@$room_users);
+die "refusing to sync to empty group" unless (@$group_users);
+
 my $diff = {};
 foreach my $user (@$room_users) { $diff->{$user}++ }
 foreach my $user (@$group_users) { $diff->{$user}-- }
@@ -39,4 +42,4 @@ foreach my $user (keys %$diff) {
         warn "removing $user";
         print STDERR $ua->put("${hs}/_matrix/client/unstable/groups/${group_id}/admin/users/remove/${user}?access_token=${access_token}", Content=>'{}')->status_line."\n";
     }
-}
\ No newline at end of file
+}