added nsfw flag to claims retrieval api
This commit is contained in:
parent
65924fdb3c
commit
a2e9b8142e
1 changed files with 5 additions and 0 deletions
|
@ -14,6 +14,7 @@ class ClaimsController extends AppController {
|
||||||
$beforeId = intval($this->request->query('before'));
|
$beforeId = intval($this->request->query('before'));
|
||||||
$afterId = intval($this->request->query('after'));
|
$afterId = intval($this->request->query('after'));
|
||||||
$sort = trim($this->request->query('sort'));
|
$sort = trim($this->request->query('sort'));
|
||||||
|
$nsfw = trim($this->request->query('nsfw'));
|
||||||
switch ($sort) {
|
switch ($sort) {
|
||||||
case 'popular':
|
case 'popular':
|
||||||
// TODO: sort by upvote/downvote score
|
// TODO: sort by upvote/downvote score
|
||||||
|
@ -46,6 +47,10 @@ class ClaimsController extends AppController {
|
||||||
$conditions['Claims.Id <'] = $beforeId;
|
$conditions['Claims.Id <'] = $beforeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($nsfw !== 'true') {
|
||||||
|
$conditions['IsNSFW <>'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$claims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->distinct(['Claims.ClaimId'])->where($conditions)->
|
$claims = $this->Claims->find()->contain(['Stream', 'Publisher' => ['fields' => ['Name']]])->distinct(['Claims.ClaimId'])->where($conditions)->
|
||||||
limit($pageLimit)->order($order)->toArray();
|
limit($pageLimit)->order($order)->toArray();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue