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

Bugfixes

parent a2b90966
Branches
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) {
$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'} },
) ) {
......
......@@ -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;
});
......
......@@ -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
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment