From b86362b3662c0bc53675cef0339d6f199cc9ad50 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Mon, 3 Mar 2014 21:05:44 +0100 Subject: [PATCH] Minor tweaks to search aliases --- src/Models/SearchParsers/PostSearchParser.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Models/SearchParsers/PostSearchParser.php b/src/Models/SearchParsers/PostSearchParser.php index 130f0fa5..6f5b96b9 100644 --- a/src/Models/SearchParsers/PostSearchParser.php +++ b/src/Models/SearchParsers/PostSearchParser.php @@ -65,7 +65,7 @@ class PostSearchParser extends AbstractSearchParser return Sql\InFunctor::fromArray('post.id', Sql\Binding::fromArray($ids)); } - elseif (in_array($key, ['fav', 'favs'])) + elseif (in_array($key, ['fav', 'favs', 'favd'])) { $user = UserModel::findByNameOrEmail($value); $innerStmt = (new Sql\SelectStatement) @@ -76,7 +76,7 @@ class PostSearchParser extends AbstractSearchParser return new Sql\ExistsFunctor($innerStmt); } - elseif (in_array($key, ['comment', 'commenter'])) + elseif (in_array($key, ['comment', 'comments', 'commenter', 'commented'])) { $user = UserModel::findByNameOrEmail($value); $innerStmt = (new Sql\SelectStatement) @@ -87,7 +87,7 @@ class PostSearchParser extends AbstractSearchParser return new Sql\ExistsFunctor($innerStmt); } - elseif (in_array($key, ['submit', 'upload', 'uploader', 'uploaded'])) + elseif (in_array($key, ['submit', 'upload', `uploads`, 'uploader', 'uploaded'])) { $user = UserModel::findByNameOrEmail($value); return new Sql\EqualsFunctor('uploader_id', new Sql\Binding($user->id)); @@ -147,7 +147,7 @@ class PostSearchParser extends AbstractSearchParser { $context = \Chibi\Registry::getContext(); $value = strtolower($value); - if (in_array($value, ['fav', 'favs', 'favd', 'favorite', 'favorites'])) + if (in_array($value, ['fav', 'favs', 'favd'])) { return $this->prepareCriterionForComplexToken('fav', $context->user->name); }