diff --git a/public/js/vroom.js b/public/js/vroom.js index 1751404..8a7868f 100644 --- a/public/js/vroom.js +++ b/public/js/vroom.js @@ -286,7 +286,8 @@ $('#configureRoomForm').submit(function(e){ $('#joinPass').val() : false, ownerPass = ($('#ownerPassSet').bootstrapSwitch('state')) ? $('#ownerPass').val() : false, - persistent = $('#persistentSet').bootstrapSwitch('state'), + persist = ($('#persistentSet').length > 0) ? + $('#persistentSet').bootstrapSwitch('state') : '', emails = []; $('input[name="emails[]"]').each(function(){ emails.push($(this).val()); @@ -301,7 +302,7 @@ $('#configureRoomForm').submit(function(e){ ask_for_name: askForName, join_password: joinPass, owner_password: ownerPass, - persistent: persistent, + persistent: persist, emails: emails } }) diff --git a/vroom.pl b/vroom.pl index 68d204d..0d51463 100755 --- a/vroom.pl +++ b/vroom.pl @@ -1300,14 +1300,6 @@ any '/api' => sub { } # Ok, now, we don't have to bother with authorization anymore if ($req->{action} eq 'invite_email'){ - #if (!$req->{param}->{rcpts}){ - # return $self->render( - # json => { - # status => 'error', - # msg => $self->l('ERROR_MAIL_INVALID') - # } - # ); - #} my $rcpts = $req->{param}->{rcpts}; foreach my $addr (@$rcpts){ if (!$self->valid_email($addr) && $addr ne ''){ @@ -1407,8 +1399,8 @@ any '/api' => sub { $room->{locked} = ($req->{param}->{locked}) ? '1' : '0'; $room->{ask_for_name} = ($req->{param}->{ask_for_name}) ? '1' : '0'; # Room persistence can only be set by admins - if ($self->key_can_do_this(token => $token, action => 'set_persistent')){ - $room->{persistent} = ($req->{param}->{persistent}) ? '1' : '0'; + if ($self->key_can_do_this(token => $token, action => 'set_persistent') && $req->{param}->{persistent} ne ''){ + $room->{persistent} = ($req->{param}->{persistent} eq Mojo::JSON->true) ? '1' : '0'; } foreach my $pass (qw/join_password owner_password/){ if ($req->{param}->{$pass} eq Mojo::JSON->false){