From c2b201d36be0c2b4cdbad899df4aaecdb6a725d9 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Fri, 3 Oct 2014 15:30:33 +0200 Subject: [PATCH] Added special:fav support to post searching --- TODO | 1 - src/SearchServices/Parsers/PostSearchParser.php | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 5a15cf4b..dbb874ae 100644 --- a/TODO +++ b/TODO @@ -12,7 +12,6 @@ everything related to posts: - comment_count: 3..5 - file_size:3K..5M - image_size:huge/large/medium/small - - special:fav - search order - order:comment_count - order:comment_time diff --git a/src/SearchServices/Parsers/PostSearchParser.php b/src/SearchServices/Parsers/PostSearchParser.php index 0c1ed0e5..285dc8b3 100644 --- a/src/SearchServices/Parsers/PostSearchParser.php +++ b/src/SearchServices/Parsers/PostSearchParser.php @@ -62,6 +62,14 @@ class PostSearchParser extends AbstractSearchParser elseif ($token->getKey() === 'special' and $token->getValue() === 'disliked' and $this->authService->isLoggedIn()) $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 throw new \BadMethodCallException('Not supported'); }