Skip to content

Commit eb0be44

Browse files
Take into account APP_SHOW_ONLY_ASSIGNED_CONVERSATIONS option on customer Conversation tab
1 parent cfdcdaf commit eb0be44

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

app/Http/Controllers/CustomersController.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,18 @@ public function conversations($id)
233233
{
234234
$customer = Customer::findOrFail($id);
235235

236-
$conversations = $customer->conversations()
236+
$query = $customer->conversations()
237237
->where('customer_id', $customer->id)
238238
->whereIn('mailbox_id', auth()->user()->mailboxesIdsCanView())
239-
->orderBy('created_at', 'desc')
240-
->paginate(Conversation::DEFAULT_LIST_SIZE);
239+
->orderBy('created_at', 'desc');
240+
241+
$user = auth()->user();
242+
243+
if ($user->canSeeOnlyAssignedConversations()) {
244+
$query->where('user_id', '=', $user->id);
245+
}
246+
247+
$conversations = $query->paginate(Conversation::DEFAULT_LIST_SIZE);
241248

242249
return view('customers/conversations', [
243250
'customer' => $customer,

0 commit comments

Comments
 (0)