diff --git a/VERSION b/VERSION index 097a15a2af39df14efb57a9212fc648b52746783..2714f5313ae11cebf3c524b8b58ca47df56e5deb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.2 +2.6.4 diff --git a/lib/PZ/Controller/Shortcut.pm b/lib/PZ/Controller/Shortcut.pm index a158986461992b26c44285b0a75d5fdb1f8bdcee..a293765522247a7319c9e8d072312ece3b032633 100644 --- a/lib/PZ/Controller/Shortcut.pm +++ b/lib/PZ/Controller/Shortcut.pm @@ -61,7 +61,7 @@ sub create ($c) { $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, title => $title, shortcut => ($custom || $c->schema->resultset('Shortcut')->generate()) @@ -99,7 +99,7 @@ sub list ($c) { my @shortcuts = (); SHORTCUT: - foreach my $shortcut ( $c->user->shortcuts( + foreach my $shortcut ( $c->current_user->shortcuts( { deleted => undef }, { order_by => {-desc => 'created'} }, ) ) { diff --git a/lib/PZ/Helpers/Core.pm b/lib/PZ/Helpers/Core.pm index f6f43b54a1904a97b56fc4adae3120cd93c5b092..54efe8036835d840eba2d1099bcfe26eebaf2d05 100644 --- a/lib/PZ/Helpers/Core.pm +++ b/lib/PZ/Helpers/Core.pm @@ -92,9 +92,10 @@ sub register { $self->helper( shortcut => sub { my $c = shift; my $id = shift // $c->stash->{id}; + my $user = $c->stash->{user} || $c->current_user; my $shortcut = $c->schema->resultset('Shortcut')->find({ id => $id }); 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; }); diff --git a/openapi.yaml b/openapi.yaml index 1c0897c3834c4b37c557e10855f0afb923156c40..47ddbd10e36f4fcb30d37a3bcc55a1cfcbccfbb5 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -3,7 +3,7 @@ openapi: 3.0.3 info: title: Piratský zkracovač description: Piratský zkracovač API - version: 1.4.0 + version: 2.6.4 license: name: Artistic License 2.0 url: https://www.perlfoundation.org/artistic-license-20.html diff --git a/templates/shortcut.html.ep b/templates/shortcut.html.ep index 08bb87a2385aa993b1c1460281cdf3a6dc0ff86b..0fcd97f9e182039c50bce65b8f5a07817bebd228 100644 --- a/templates/shortcut.html.ep +++ b/templates/shortcut.html.ep @@ -14,7 +14,7 @@ <h2 class="head-alt-sm">Log navštěv</h2> <div> <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> </div> </div>