diff --git a/src/Api/Jobs/GetPostContentJob.php b/src/Api/Jobs/GetPostContentJob.php index 2a83d9d3..391a3b13 100644 --- a/src/Api/Jobs/GetPostContentJob.php +++ b/src/Api/Jobs/GetPostContentJob.php @@ -35,7 +35,7 @@ class GetPostContentJob extends AbstractJob $post = $this->post; $privileges = []; - if ($post->hidden) + if ($post->isHidden()) $privileges []= new Privilege(Privilege::ViewPost, 'hidden'); $privileges []= new Privilege(Privilege::ViewPost, $post->getSafety()->toString()); diff --git a/src/Api/Jobs/GetPostJob.php b/src/Api/Jobs/GetPostJob.php index f42194ac..860f7613 100644 --- a/src/Api/Jobs/GetPostJob.php +++ b/src/Api/Jobs/GetPostJob.php @@ -15,7 +15,7 @@ class GetPostJob extends AbstractPostJob $post = $this->post; $privileges = []; - if ($post->hidden) + if ($post->isHidden()) $privileges []= new Privilege(Privilege::ViewPost, 'hidden'); $privileges []= new Privilege(Privilege::ViewPost, $post->getSafety()->toString()); diff --git a/src/Api/Jobs/GetPostThumbJob.php b/src/Api/Jobs/GetPostThumbJob.php index c87739c3..20c533a2 100644 --- a/src/Api/Jobs/GetPostThumbJob.php +++ b/src/Api/Jobs/GetPostThumbJob.php @@ -18,7 +18,7 @@ class GetPostThumbJob extends AbstractJob { $post = PostModel::findByIdOrName($name); - if ($post->hidden) + if ($post->isHidden()) Access::assert(new Privilege(Privilege::ListPosts, 'hidden')); Access::assert(new Privilege(Privilege::ListPosts, $post->getSafety()->toString())); diff --git a/src/Models/Entities/PostEntity.php b/src/Models/Entities/PostEntity.php index 5fb47abc..9bbd64e2 100644 --- a/src/Models/Entities/PostEntity.php +++ b/src/Models/Entities/PostEntity.php @@ -11,7 +11,7 @@ class PostEntity extends AbstractEntity implements IValidatable public $fileSize; public $mimeType; protected $safety; - public $hidden; + protected $hidden; public $uploadDate; protected $imageWidth; protected $imageHeight; @@ -182,6 +182,11 @@ class PostEntity extends AbstractEntity implements IValidatable return false; } + public function isHidden() + { + return $this->hidden; + } + public function setHidden($hidden) { $this->hidden = boolval($hidden); diff --git a/src/Models/PostModel.php b/src/Models/PostModel.php index 99e3d59a..9b6c7ecc 100644 --- a/src/Models/PostModel.php +++ b/src/Models/PostModel.php @@ -26,7 +26,7 @@ class PostModel extends AbstractCrudModel { $post = new PostEntity; $post->setSafety(new PostSafety(PostSafety::Safe)); - $post->hidden = false; + $post->setHidden(false); $post->uploadDate = time(); do { @@ -52,7 +52,7 @@ class PostModel extends AbstractCrudModel 'file_size' => $post->fileSize, 'mime_type' => $post->mimeType, 'safety' => $post->getSafety()->toInteger(), - 'hidden' => $post->hidden, + 'hidden' => $post->isHidden(), 'upload_date' => $post->uploadDate, 'image_width' => $post->getImageWidth(), 'image_height' => $post->getImageHeight(), diff --git a/src/Views/post-view.phtml b/src/Views/post-view.phtml index 029843f7..0ec7c0d3 100644 --- a/src/Views/post-view.phtml +++ b/src/Views/post-view.phtml @@ -320,7 +320,7 @@ $canEditAnything = count(array_filter($editPostPrivileges)) > 0; Privilege::HidePost, Access::getIdentity($this->context->transport->post->getUploader())))) { - if ($this->context->transport->post->hidden) + if ($this->context->transport->post->isHidden()) { $options []= [