mirror of
https://github.com/flarum/framework.git
synced 2025-02-02 20:06:15 +08:00
fixes author gambit when used with fulltext search, added test to cover (#1620)
* fixes author gambit when used with fulltext search, added test to cover * Apply fixes from StyleCI [ci skip] [skip ci]
This commit is contained in:
parent
ac5a6349e4
commit
b64cdb1cfe
|
@ -54,6 +54,6 @@ class AuthorGambit extends AbstractRegexGambit
|
|||
$ids[] = $this->users->getIdForUsername($username);
|
||||
}
|
||||
|
||||
$search->getQuery()->whereIn('user_id', $ids, 'and', $negate);
|
||||
$search->getQuery()->whereIn('discussions.user_id', $ids, 'and', $negate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,12 @@ namespace Flarum\Tests\Api\Controller;
|
|||
|
||||
use Flarum\Api\Controller\ListDiscussionsController;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Tests\Test\Concerns\RetrievesAuthorizedUsers;
|
||||
|
||||
class ListDiscussionControllerTest extends ApiControllerTestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected $controller = ListDiscussionsController::class;
|
||||
|
||||
/**
|
||||
|
@ -30,4 +33,21 @@ class ListDiscussionControllerTest extends ApiControllerTestCase
|
|||
|
||||
$this->assertEquals(Discussion::count(), count($data['data']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function can_search_for_author()
|
||||
{
|
||||
$user = $this->getNormalUser();
|
||||
|
||||
$response = $this->callWith([], [
|
||||
'filter' => [
|
||||
'q' => 'author:'.$user->username.' foo'
|
||||
],
|
||||
'include' => 'mostRelevantPost'
|
||||
]);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user