Skip to content
Snippets Groups Projects
Verified Commit 68f6aeb2 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Uspornejsi prace s uzivatelem, zmena pocitani

parent 445fb794
Branches
No related tags found
No related merge requests found
......@@ -14,6 +14,8 @@ sub main {
my $c = shift;
my $ip = $c->tx->remote_address;
my $user;
$c->inactivity_timeout(SOCKET_INACTIVITY_TIMEOUT);
my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg);
......@@ -25,12 +27,11 @@ sub main {
$c->on(json => sub( $c, $message ) {
if ( $message->{event} eq 'KEEPALIVE' ) {
my $user;
if ($message->{payload} =~ /^(\d+)$/) {
# TODO: check signtaure
$user = $c->schema->resultset('User')->find(
$user //= $c->schema->resultset('User')->find(
{ id => $1 }
);
}
......@@ -42,12 +43,10 @@ sub main {
user_id => $user ? $user->id : undef,
}, { key => $user ? 'user':'primary'} );
my $all = $c->schema->resultset('Socket_view')->count(
{ is_alive => 't', }
);
my $all = $c->schema->resultset('Socket_view')->count();
my $members = $c->schema->resultset('Socket_view')->count(
{ is_alive => 't', is_member => 't' }
{ is_member => 't' }
);
my $group_size = $c->_member_group_size($members);
......@@ -64,7 +63,7 @@ sub main {
$c->send({json => { event => 'user_status', payload => {
jitsi_allowed => $jitsi ? \1:\0,
# is_banned => $user->banned_until ? 1:0,
is_banned => $user->banned_until ? \1:\0,
}}});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment