mirror of
https://github.com/flarum/core.git
synced 2025-08-14 12:24:33 +02:00
Replaced whereExists/whereNotExists with whereIn/whereNotIn (#22)
This commit is contained in:
committed by
Franz Liedke
parent
907cc2fbe7
commit
b92e5a214f
@@ -26,14 +26,12 @@ class SubscriptionGambit extends AbstractRegexGambit
|
|||||||
{
|
{
|
||||||
$actor = $search->getActor();
|
$actor = $search->getActor();
|
||||||
|
|
||||||
// might be better as `id IN (subquery)`?
|
$method = $negate ? 'whereNotIn' : 'whereIn';
|
||||||
$method = $negate ? 'whereNotExists' : 'whereExists';
|
$search->getQuery()->$method('id', function ($query) use ($actor, $matches) {
|
||||||
$search->getQuery()->$method(function ($query) use ($actor, $matches) {
|
$query->select('discussion_id')
|
||||||
$query->selectRaw('1')
|
->from('discussion_user')
|
||||||
->from('discussion_user')
|
->where('user_id', $actor->id)
|
||||||
->whereColumn('discussions.id', 'discussion_id')
|
->where('subscription', $matches[1] === 'follow' ? 'follow' : 'ignore');
|
||||||
->where('user_id', $actor->id)
|
|
||||||
->where('subscription', $matches[1] === 'follow' ? 'follow' : 'ignore');
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user