|
|
@ -422,19 +422,16 @@ helper get_peer_role => sub { |
|
|
|
LIMIT 1'); |
|
|
|
LIMIT 1'); |
|
|
|
}; |
|
|
|
}; |
|
|
|
if ($@){ |
|
|
|
if ($@){ |
|
|
|
return {msg => $@}; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
$sth->execute($data->{peer_id},$data->{room}); |
|
|
|
$sth->execute($data->{peer_id},$data->{room}); |
|
|
|
if ($sth->err){ |
|
|
|
if ($sth->err){ |
|
|
|
return {msg => "DB Error: " . $sth->errstr . " (code " . $sth->err . ")"}; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
my $role; |
|
|
|
my $role; |
|
|
|
$sth->bind_columns(\$role); |
|
|
|
$sth->bind_columns(\$role); |
|
|
|
$sth->fetch; |
|
|
|
$sth->fetch; |
|
|
|
return { |
|
|
|
return $role; |
|
|
|
ok => 1, |
|
|
|
|
|
|
|
data => $role |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
# Promote a peer to owner |
|
|
|
# Promote a peer to owner |
|
|
@ -1532,7 +1529,7 @@ post '/*action' => [action => [qw/action admin\/action/]] => sub { |
|
|
|
my $id = $self->param('id'); |
|
|
|
my $id = $self->param('id'); |
|
|
|
my %emailNotif; |
|
|
|
my %emailNotif; |
|
|
|
if ($self->session($room) && $self->session($room)->{role}){ |
|
|
|
if ($self->session($room) && $self->session($room)->{role}){ |
|
|
|
if ($self->session($room)->{role} ne 'owner' && $self->get_peer_role({room => $room, peer_id => $id})->{data} eq 'owner'){ |
|
|
|
if ($self->session($room)->{role} ne 'owner' && $self->get_peer_role({room => $room, peer_id => $id}) eq 'owner'){ |
|
|
|
$self->session($room)->{role} = 'owner'; |
|
|
|
$self->session($room)->{role} = 'owner'; |
|
|
|
} |
|
|
|
} |
|
|
|
my $res = $self->set_peer_role({ |
|
|
|
my $res = $self->set_peer_role({ |
|
|
|