mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-13 11:43:25 +01:00
sanity checks
This commit is contained in:
parent
2145ee1976
commit
3ab2cfec47
1 changed files with 4 additions and 1 deletions
|
@ -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}}),
|
(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 = {};
|
my $diff = {};
|
||||||
foreach my $user (@$room_users) { $diff->{$user}++ }
|
foreach my $user (@$room_users) { $diff->{$user}++ }
|
||||||
foreach my $user (@$group_users) { $diff->{$user}-- }
|
foreach my $user (@$group_users) { $diff->{$user}-- }
|
||||||
|
@ -39,4 +42,4 @@ foreach my $user (keys %$diff) {
|
||||||
warn "removing $user";
|
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";
|
print STDERR $ua->put("${hs}/_matrix/client/unstable/groups/${group_id}/admin/users/remove/${user}?access_token=${access_token}", Content=>'{}')->status_line."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue