diff --git a/src/Controller/ClaimsController.php b/src/Controller/ClaimsController.php index a06beec..deb6348 100644 --- a/src/Controller/ClaimsController.php +++ b/src/Controller/ClaimsController.php @@ -14,6 +14,7 @@ class ClaimsController extends AppController { $beforeId = intval($this->request->query('before')); $afterId = intval($this->request->query('after')); $sort = trim($this->request->query('sort')); + $nsfw = trim($this->request->query('nsfw')); switch ($sort) { case 'popular': // TODO: sort by upvote/downvote score @@ -46,6 +47,10 @@ class ClaimsController extends AppController { $conditions['Claims.Id <'] = $beforeId; } + if ($nsfw !== 'true') { + $conditions['IsNSFW <>'] = 1; + } + $claims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->distinct(['Claims.ClaimId'])->where($conditions)-> limit($pageLimit)->order($order)->toArray();