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
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,8 @@ sub main { ...@@ -14,6 +14,8 @@ sub main {
my $c = shift; my $c = shift;
my $ip = $c->tx->remote_address; my $ip = $c->tx->remote_address;
my $user;
$c->inactivity_timeout(SOCKET_INACTIVITY_TIMEOUT); $c->inactivity_timeout(SOCKET_INACTIVITY_TIMEOUT);
my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg); my $pubsub = Mojo::Pg::PubSub->new(pg => $c->pg);
...@@ -25,12 +27,11 @@ sub main { ...@@ -25,12 +27,11 @@ sub main {
$c->on(json => sub( $c, $message ) { $c->on(json => sub( $c, $message ) {
if ( $message->{event} eq 'KEEPALIVE' ) { if ( $message->{event} eq 'KEEPALIVE' ) {
my $user;
if ($message->{payload} =~ /^(\d+)$/) { if ($message->{payload} =~ /^(\d+)$/) {
# TODO: check signtaure # TODO: check signtaure
$user = $c->schema->resultset('User')->find( $user //= $c->schema->resultset('User')->find(
{ id => $1 } { id => $1 }
); );
} }
...@@ -42,12 +43,10 @@ sub main { ...@@ -42,12 +43,10 @@ sub main {
user_id => $user ? $user->id : undef, user_id => $user ? $user->id : undef,
}, { key => $user ? 'user':'primary'} ); }, { key => $user ? 'user':'primary'} );
my $all = $c->schema->resultset('Socket_view')->count( my $all = $c->schema->resultset('Socket_view')->count();
{ is_alive => 't', }
);
my $members = $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); my $group_size = $c->_member_group_size($members);
...@@ -64,7 +63,7 @@ sub main { ...@@ -64,7 +63,7 @@ sub main {
$c->send({json => { event => 'user_status', payload => { $c->send({json => { event => 'user_status', payload => {
jitsi_allowed => $jitsi ? \1:\0, 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