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 @@
= pp_html_escape($error) ?>
- +