Skip to content

Commit

Permalink
Allow to hide from support agents customers from non-visible mailboxe…
Browse files Browse the repository at this point in the history
…s - closes #4316
  • Loading branch information
freescout-help-desk committed Nov 1, 2024
1 parent 9a6429e commit bbcba6e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/Http/Controllers/CustomersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,21 @@ public function ajax(Request $request)

switch ($request->action) {

// Change conversation user
// Change conversation customer.
case 'create':
// First name or email must be specified
$validator = Validator::make($request->all(), [
$validator_config = [
'first_name' => 'required|string|max:255',
'last_name' => 'nullable|string|max:255',
'email' => 'required|email|unique:emails,email',
]);
];

$limited_visibility = config('app.limit_user_customer_visibility') && !$user->isAdmin();
if ($limited_visibility) {
$validator_config['email'] = 'required|email';
}

// First name or email must be specified.
$validator = Validator::make($request->all(), $validator_config);

if ($validator->fails()) {
foreach ($validator->errors()->getMessages()as $errors) {
Expand Down

0 comments on commit bbcba6e

Please sign in to comment.