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

Bugfixes

parent a2b90966
No related branches found
No related tags found
No related merge requests found
Pipeline #11711 passed
2.6.2 2.6.4
...@@ -61,7 +61,7 @@ sub create ($c) { ...@@ -61,7 +61,7 @@ sub create ($c) {
$title = $ua->get($url)->result->dom->at('title')->text; $title = $ua->get($url)->result->dom->at('title')->text;
}; };
my $shortcut = $c->user->add_to_shortcuts({ my $shortcut = $c->current_user->add_to_shortcuts({
url => $url, url => $url,
title => $title, title => $title,
shortcut => ($custom || $c->schema->resultset('Shortcut')->generate()) shortcut => ($custom || $c->schema->resultset('Shortcut')->generate())
...@@ -99,7 +99,7 @@ sub list ($c) { ...@@ -99,7 +99,7 @@ sub list ($c) {
my @shortcuts = (); my @shortcuts = ();
SHORTCUT: SHORTCUT:
foreach my $shortcut ( $c->user->shortcuts( foreach my $shortcut ( $c->current_user->shortcuts(
{ deleted => undef }, { deleted => undef },
{ order_by => {-desc => 'created'} }, { order_by => {-desc => 'created'} },
) ) { ) ) {
......
...@@ -92,9 +92,10 @@ sub register { ...@@ -92,9 +92,10 @@ sub register {
$self->helper( shortcut => sub { $self->helper( shortcut => sub {
my $c = shift; my $c = shift;
my $id = shift // $c->stash->{id}; my $id = shift // $c->stash->{id};
my $user = $c->stash->{user} || $c->current_user;
my $shortcut = $c->schema->resultset('Shortcut')->find({ id => $id }); my $shortcut = $c->schema->resultset('Shortcut')->find({ id => $id });
return $c->error(404, 'NOT_FOUND') if ! $shortcut; return $c->error(404, 'NOT_FOUND') if ! $shortcut;
return $c->error(403, 'ACCESS_DENIED') if $shortcut->user_id != $c->stash->{user}->id; return $c->error(403, 'ACCESS_DENIED') if $shortcut->user_id != $c->user->id;
return $shortcut; return $shortcut;
}); });
......
...@@ -3,7 +3,7 @@ openapi: 3.0.3 ...@@ -3,7 +3,7 @@ openapi: 3.0.3
info: info:
title: Piratský zkracovač title: Piratský zkracovač
description: Piratský zkracovač API description: Piratský zkracovač API
version: 1.4.0 version: 2.6.4
license: license:
name: Artistic License 2.0 name: Artistic License 2.0
url: https://www.perlfoundation.org/artistic-license-20.html url: https://www.perlfoundation.org/artistic-license-20.html
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<h2 class="head-alt-sm">Log navštěv</h2> <h2 class="head-alt-sm">Log navštěv</h2>
<div> <div>
<button class="btn btn--orange-400 btn--hoveractive text-sm"> <button class="btn btn--orange-400 btn--hoveractive text-sm">
<div class="btn__body"><i class="btn__inline-icon ico--download"></i><a href="/shortcuts/<%= stash->{id} %>/log.csv">Stahnout CSV</a></div> <div class="btn__body"><i class="btn__inline-icon ico--download"></i><a href="/shortcut/<%= stash->{id} %>/log.csv">Stahnout CSV</a></div>
</button> </button>
</div> </div>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment