mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 18:27:47 +08:00
Merge pull request #703 from Albert221/master
#256 Added multiple author search gambit
This commit is contained in:
commit
b671c3ccfa
|
@ -45,10 +45,14 @@ class AuthorGambit extends AbstractRegexGambit
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user