mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
Make viewing pastes work again, for real.
This commit is contained in:
parent
ee097929c0
commit
4da8904520
2 changed files with 4 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ $flashes = getFlashes();
|
|||
</span>
|
||||
<span>Archive</span>
|
||||
</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">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
|
|
Loading…
Add table
Reference in a new issue