#256 Added multiple author search gambit

This commit is contained in:
Albert221 2016-01-03 14:26:41 +01:00
parent 1f2eaea960
commit 6dfe455fd6

View File

@ -45,10 +45,14 @@ class AuthorGambit extends AbstractRegexGambit
throw new LogicException('This gambit can only be applied on a DiscussionSearch'); throw new LogicException('This gambit can only be applied on a DiscussionSearch');
} }
$username = trim($matches[1], '"'); $usernames = trim($matches[1], '"');
$usernames = explode(',', $usernames);
$id = $this->users->getIdForUsername($username); $ids = [];
foreach($usernames as $username) {
$ids[] = $this->users->getIdForUsername($username);
}
$search->getQuery()->where('start_user_id', $negate ? '!=' : '=', $id); $search->getQuery()->whereIn('start_user_id', $ids, 'and', $negate);
} }
} }