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

Deleting user.id 0

parent 55491a16
No related branches found
No related tags found
No related merge requests found
Pipeline #1834 passed
...@@ -3,7 +3,7 @@ image: docker:19.03.1 ...@@ -3,7 +3,7 @@ image: docker:19.03.1
variables: variables:
DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_CERTDIR: "/certs"
IMAGE_TAG: $CI_REGISTRY_IMAGE IMAGE_TAG: $CI_REGISTRY_IMAGE
IMAGE_VER: 0.3.0 IMAGE_VER: 0.3.1
services: services:
- docker:19.03.1-dind - docker:19.03.1-dind
......
...@@ -50,9 +50,11 @@ sub get ($c) { ...@@ -50,9 +50,11 @@ sub get ($c) {
my $formatted = $post->format(); my $formatted = $post->format();
if ( $c->user ) {
if (my $my_vote = $post->rankings({ user_id => $c->user->{id} })->first) { if (my $my_vote = $post->rankings({ user_id => $c->user->{id} })->first) {
$formatted->{ranking}{my_vote} = $my_vote->ranking; $formatted->{ranking}{my_vote} = $my_vote->ranking;
} }
}
foreach my $history ( $post->history() ) { foreach my $history ( $post->history() ) {
push @{ $formatted->{history_log} }, { push @{ $formatted->{history_log} }, {
...@@ -108,6 +110,7 @@ sub list ($c) { ...@@ -108,6 +110,7 @@ sub list ($c) {
} }
# hodnoceni aktualniho uzivatele # hodnoceni aktualniho uzivatele
if ( $c->user ) {
my $my_vote = {}; my $my_vote = {};
my $rankings = $c->schema->resultset('PostRanking')->search({ my $rankings = $c->schema->resultset('PostRanking')->search({
...@@ -116,6 +119,7 @@ sub list ($c) { ...@@ -116,6 +119,7 @@ sub list ($c) {
while ( my $record = $rankings->next() ) { while ( my $record = $rankings->next() ) {
$my_vote->{ $record->post_id } = $record->ranking; $my_vote->{ $record->post_id } = $record->ranking;
} }
}
my @posts = (); my @posts = ();
......
...@@ -74,7 +74,7 @@ sub register ( $class, $self, $conf) { ...@@ -74,7 +74,7 @@ sub register ( $class, $self, $conf) {
}); });
$self->helper( user => sub ( $c ) { $self->helper( user => sub ( $c ) {
my $claims = $c->oauth_claims // return { id => 0 }; my $claims = $c->oauth_claims // return undef;
if ( ! $c->stash->{user} ) { if ( ! $c->stash->{user} ) {
$c->stash->{user} = { $c->stash->{user} = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment