Skip to content

Commit

Permalink
Improve whereFlagged subquery (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland authored Mar 7, 2022
1 parent 7d955e0 commit 1d67c1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Database/RecipientsConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,12 @@ protected function whenFlagged($query)
->whereIn('discussions.id', function ($query) {
$query
->select('posts.discussion_id')
->from('flags')
->Join('posts', 'flags.post_id', 'posts.id')
->from('posts')
->whereIn('posts.id', function ($query) {
$query->select('flags.post_id')
->from('flags')
->distinct();
})
->distinct();
});
});
Expand Down

0 comments on commit 1d67c1a

Please sign in to comment.