Added special:fav search aliases

It displays favorites of user currently logged in.
This commit is contained in:
Marcin Kurczewski 2014-02-28 20:57:06 +01:00
parent fa251e60b6
commit 426e104bbe

View file

@ -145,7 +145,12 @@ class PostSearchParser extends AbstractSearchParser
{ {
$context = \Chibi\Registry::getContext(); $context = \Chibi\Registry::getContext();
$value = strtolower($value); $value = strtolower($value);
if (in_array($value, ['like', 'liked', 'likes'])) if (in_array($value, ['fav', 'favs', 'favd', 'favorite', 'favorites']))
{
return $this->prepareCriterionForComplexToken('fav', $context->user->name);
}
elseif (in_array($value, ['like', 'liked', 'likes']))
{ {
if (!$this->statement->isTableJoined('post_score')) if (!$this->statement->isTableJoined('post_score'))
{ {