From ee097929c05f2e1359df27e58a78af48e60ed1f4 Mon Sep 17 00:00:00 2001 From: Floorb <132411956+Neetpone@users.noreply.github.com> Date: Mon, 18 Apr 2022 14:05:26 -0400 Subject: [PATCH] Make viewing pastes work again --- includes/Helpers/AbilityHelper.php | 8 ++------ theme/bulma/errors.php | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/includes/Helpers/AbilityHelper.php b/includes/Helpers/AbilityHelper.php index a3cf273..bf51d4c 100644 --- a/includes/Helpers/AbilityHelper.php +++ b/includes/Helpers/AbilityHelper.php @@ -16,22 +16,18 @@ class AbilityHelper { } public function can(string $action, mixed $subject) : bool { - if ($this->user === null) { - return false; - } - $is_destructive = in_array($action, self::DESTRUCTIVE_ACTIONS); if (is_a($subject, 'Paste')) { if (($subject->visible == Paste::VISIBILITY_PRIVATE) || $is_destructive) { - return $subject->user_id === $this->user->id; + return $this->user !== null && $subject->user_id === $this->user->id; } return true; } if (is_a($subject, 'User')) { - return !$is_destructive || $subject->id === $this->user->id; + return !$is_destructive || ($this->user !== null && $subject->id === $this->user->id); } return false; diff --git a/theme/bulma/errors.php b/theme/bulma/errors.php index c5cd6bd..3fb32d6 100644 --- a/theme/bulma/errors.php +++ b/theme/bulma/errors.php @@ -5,7 +5,7 @@

- +

This paste is password-protected.