Added special:fav support to post searching

This commit is contained in:
Marcin Kurczewski 2014-10-03 15:30:33 +02:00
parent 5db571ab7f
commit c2b201d36b
2 changed files with 8 additions and 1 deletions

1
TODO
View file

@ -12,7 +12,6 @@ everything related to posts:
- comment_count: 3..5 - comment_count: 3..5
- file_size:3K..5M - file_size:3K..5M
- image_size:huge/large/medium/small - image_size:huge/large/medium/small
- special:fav
- search order - search order
- order:comment_count - order:comment_count
- order:comment_time - order:comment_time

View file

@ -62,6 +62,14 @@ class PostSearchParser extends AbstractSearchParser
elseif ($token->getKey() === 'special' and $token->getValue() === 'disliked' and $this->authService->isLoggedIn()) elseif ($token->getKey() === 'special' and $token->getValue() === 'disliked' and $this->authService->isLoggedIn())
$this->addUserScoreRequirement($filter, $this->authService->getLoggedInUser()->getName(), -1, $token->isNegated()); $this->addUserScoreRequirement($filter, $this->authService->getLoggedInUser()->getName(), -1, $token->isNegated());
elseif ($token->getKey() === 'special' and $token->getValue() === 'fav' and $this->authService->isLoggedIn())
{
$token = new \Szurubooru\SearchServices\Tokens\NamedSearchToken();
$token->setKey('fav');
$token->setValue($this->authService->getLoggedInUser()->getName());
$this->decorateFilterFromNamedToken($filter, $token);
}
else else
throw new \BadMethodCallException('Not supported'); throw new \BadMethodCallException('Not supported');
} }