mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
Make sure query filter works with database prefix
Related to flarum/core#269.
This commit is contained in:
parent
26e6993a49
commit
74fdf7b79c
|
@ -2,6 +2,7 @@
|
|||
|
||||
use Flarum\Core\Search\Search;
|
||||
use Flarum\Core\Search\RegexGambit;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
|
||||
class SubscriptionGambit extends RegexGambit
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ class SubscriptionGambit extends RegexGambit
|
|||
$search->getQuery()->$method(function ($query) use ($actor, $matches) {
|
||||
$query->select(app('flarum.db')->raw(1))
|
||||
->from('users_discussions')
|
||||
->whereRaw('discussion_id = discussions.id')
|
||||
->where('discussions.id', new Expression('discussion_id'))
|
||||
->where('user_id', $actor->id)
|
||||
->where('subscription', $matches[1] === 'follow' ? 'follow' : 'ignore');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user