Fix room config updates

master
Daniel Berteaud 9 years ago
parent dd93818f53
commit 4a4b1dbf2e
  1. 8
      vroom.pl

@ -427,12 +427,14 @@ helper modify_room => sub {
($room->{max_members} > $config->{'rooms.max_members'} && $config->{'rooms.max_members'} > 0)){ ($room->{max_members} > $config->{'rooms.max_members'} && $config->{'rooms.max_members'} > 0)){
$room->{max_members} = 0; $room->{max_members} = 0;
} }
if ((!$room->{locked} || $room->{locked} !~ m/^0|1$/) || if (($room->{locked} && $room->{locked} !~ m/^0|1$/) ||
(!$room->{ask_for_name} || $room->{ask_for_name} !~ m/^0|1$/) || ($room->{ask_for_name} && $room->{ask_for_name} !~ m/^0|1$/) ||
(!$room->{persistent} || $room->{persistent} !~ m/^0|1$/) || ($room->{persistent} && $room->{persistent} !~ m/^0|1$/) ||
$room->{max_members} !~ m/^\d+$/){ $room->{max_members} !~ m/^\d+$/){
return 0; return 0;
} }
# Merge old and new params
$room = { %$old_room, %$room };
my $sth = eval { my $sth = eval {
$self->db->prepare('UPDATE `rooms` $self->db->prepare('UPDATE `rooms`
SET `locked`=?, SET `locked`=?,

Loading…
Cancel
Save