Skip to content

Commit

Permalink
fix web source filter to avoid mobile posts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mh-Asmi committed May 17, 2024
1 parent 1d754e1 commit fcc3a16
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,15 @@ private function setSearchCondition(PostSearchFields $search_fields, $query, boo
$join->on('posts.id', '=', 'messages.post_id');
$join->where('messages.direction', '=', "incoming");
});
// To Do : update when put all source in one place , no this condition id complex !!
if ($search_fields->webSource()) {
$query->where(function ($builder) use ($search_fields) {
$builder->whereNull('messages.type')
->orWhereIn('messages.type', $search_fields->source());
$builder->where(function ($builder_1) {
$builder_1->whereNull('messages.type')
->whereNull('posts.source');
});
$builder->orWhere('posts.source', 'web');
$builder->orWhereIn('messages.type', $search_fields->source());
if (in_array('mobile', $search_fields->source())) {
$builder->orWhere('posts.source', 'mobile');
}
Expand Down

0 comments on commit fcc3a16

Please sign in to comment.