Closed #70
This commit is contained in:
parent
d2946e0148
commit
d085ffe39a
2 changed files with 7 additions and 11 deletions
|
@ -71,7 +71,7 @@ uploadPost=registered
|
|||
listPosts=anonymous
|
||||
listPosts.sketchy=registered
|
||||
listPosts.unsafe=registered
|
||||
listPosts.hidden=nobody
|
||||
listPosts.hidden=admin
|
||||
viewPost=anonymous
|
||||
viewPost.sketchy=registered
|
||||
viewPost.unsafe=registered
|
||||
|
|
|
@ -17,14 +17,6 @@ class PostSearchService extends AbstractSearchService
|
|||
$sqlQuery->raw('safety')->in()->genSlots($allowedSafety)->put($allowedSafety);
|
||||
}
|
||||
|
||||
protected static function filterUserHidden(SqlQuery $sqlQuery)
|
||||
{
|
||||
if (!PrivilegesHelper::confirm(Privilege::ListPosts, 'hidden'))
|
||||
$sqlQuery->not('hidden');
|
||||
else
|
||||
$sqlQuery->raw('1');
|
||||
}
|
||||
|
||||
protected static function filterChain(SqlQuery $sqlQuery)
|
||||
{
|
||||
if (isset($sqlQuery->__chained))
|
||||
|
@ -144,6 +136,10 @@ class PostSearchService extends AbstractSearchService
|
|||
->close();
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
$sqlQuery->raw('hidden');
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new SimpleException('Unknown special "' . $val . '"');
|
||||
}
|
||||
|
@ -415,8 +411,6 @@ class PostSearchService extends AbstractSearchService
|
|||
|
||||
self::filterChain($sqlQuery);
|
||||
self::filterUserSafety($sqlQuery);
|
||||
self::filterChain($sqlQuery);
|
||||
self::filterUserHidden($sqlQuery);
|
||||
|
||||
/* query tokens */
|
||||
$tokens = array_filter(array_unique(explode(' ', $searchQuery)), function($x) { return $x != ''; });
|
||||
|
@ -425,6 +419,8 @@ class PostSearchService extends AbstractSearchService
|
|||
|
||||
if (\Chibi\Registry::getContext()->user->hasEnabledHidingDislikedPosts())
|
||||
$tokens []= '-special:disliked';
|
||||
if (!PrivilegesHelper::confirm(Privilege::ListPosts, 'hidden') or !in_array('special:hidden', $tokens))
|
||||
$tokens []= '-special:hidden';
|
||||
|
||||
$searchContext = new StdClass;
|
||||
$searchContext->orderColumn = 'id';
|
||||
|
|
Loading…
Reference in a new issue