From 4da89045206aaa880975cc37ba166b0541b9a6b9 Mon Sep 17 00:00:00 2001
From: Floorb <132411956+Neetpone@users.noreply.github.com>
Date: Mon, 18 Apr 2022 14:09:02 -0400
Subject: [PATCH] Make viewing pastes work again, for real.
---
includes/Helpers/AbilityHelper.php | 6 +++---
theme/bulma/common.php | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/includes/Helpers/AbilityHelper.php b/includes/Helpers/AbilityHelper.php
index bf51d4c..83d2595 100644
--- a/includes/Helpers/AbilityHelper.php
+++ b/includes/Helpers/AbilityHelper.php
@@ -18,15 +18,15 @@ class AbilityHelper {
public function can(string $action, mixed $subject) : bool {
$is_destructive = in_array($action, self::DESTRUCTIVE_ACTIONS);
- if (is_a($subject, 'Paste')) {
- if (($subject->visible == Paste::VISIBILITY_PRIVATE) || $is_destructive) {
+ if (is_a($subject, 'PonePaste\\Models\\Paste')) {
+ if (((int) $subject->visible === Paste::VISIBILITY_PRIVATE) || $is_destructive) {
return $this->user !== null && $subject->user_id === $this->user->id;
}
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);
}
diff --git a/theme/bulma/common.php b/theme/bulma/common.php
index 89bc393..409e4f0 100644
--- a/theme/bulma/common.php
+++ b/theme/bulma/common.php
@@ -103,7 +103,7 @@ $flashes = getFlashes();
Archive
-
+