Make viewing pastes work again, for real.

This commit is contained in:
Floorb 2022-04-18 14:09:02 -04:00
parent ee097929c0
commit 4da8904520
2 changed files with 4 additions and 4 deletions

View file

@ -18,15 +18,15 @@ class AbilityHelper {
public function can(string $action, mixed $subject) : bool { public function can(string $action, mixed $subject) : bool {
$is_destructive = in_array($action, self::DESTRUCTIVE_ACTIONS); $is_destructive = in_array($action, self::DESTRUCTIVE_ACTIONS);
if (is_a($subject, 'Paste')) { if (is_a($subject, 'PonePaste\\Models\\Paste')) {
if (($subject->visible == Paste::VISIBILITY_PRIVATE) || $is_destructive) { if (((int) $subject->visible === Paste::VISIBILITY_PRIVATE) || $is_destructive) {
return $this->user !== null && $subject->user_id === $this->user->id; return $this->user !== null && $subject->user_id === $this->user->id;
} }
return true; return true;
} }
if (is_a($subject, 'User')) { if (is_a($subject, 'PonePaste\\Models\\User')) {
return !$is_destructive || ($this->user !== null && $subject->id === $this->user->id); return !$is_destructive || ($this->user !== null && $subject->id === $this->user->id);
} }

View file

@ -103,7 +103,7 @@ $flashes = getFlashes();
</span> </span>
<span>Archive</span> <span>Archive</span>
</a> </a>
<a class="button navbar-item mx-2" href="<?= urlForPage('discover') ?>r"> <a class="button navbar-item mx-2" href="<?= urlForPage('discover') ?>">
<span class="icon has-text-info"> <span class="icon has-text-info">
<i class="fa fa-compass" aria-hidden="true"></i> <i class="fa fa-compass" aria-hidden="true"></i>
</span> </span>