Fix the ability to start new Conversations
This commit is contained in:
parent
f861f240d1
commit
08bf27298c
2 changed files with 8 additions and 0 deletions
|
@ -59,6 +59,7 @@ class Customer extends BaseCustomer {
|
||||||
::where('id', '=', $id)
|
::where('id', '=', $id)
|
||||||
->whereIn('mailbox_id', $mailboxes)
|
->whereIn('mailbox_id', $mailboxes)
|
||||||
->first($columns);
|
->first($columns);
|
||||||
|
return $customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,7 @@ use Illuminate\Support\ServiceProvider;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
|
||||||
use Modules\MMFRestrictedCustomers\Console\Commands\FetchEmails;
|
use Modules\MMFRestrictedCustomers\Console\Commands\FetchEmails;
|
||||||
|
use Modules\MMFRestrictedCustomers\Entities\Customer;
|
||||||
|
|
||||||
class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
|
class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +70,12 @@ class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
|
||||||
if ( array_key_exists('mailbox_id', $data) ) {
|
if ( array_key_exists('mailbox_id', $data) ) {
|
||||||
$customer->mailbox_id = $data['mailbox_id'];
|
$customer->mailbox_id = $data['mailbox_id'];
|
||||||
} else {
|
} else {
|
||||||
|
$customer = Customer::find($customer->id);
|
||||||
|
if ( $customer == null ) {
|
||||||
|
Log::error('Trying to use a Customer in another Mailbox than the one it is linked to is not allowed, and has been aborted.');
|
||||||
|
// TODO: Error out more gracefully.
|
||||||
|
abort(500, 'Trying to use a Customer in another Mailbox than the one it is linked to is not allowed, and has been aborted.');
|
||||||
|
}
|
||||||
if ( $customer->mailbox_id == null ) {
|
if ( $customer->mailbox_id == null ) {
|
||||||
Log::error('The creation of a Customer with no link to a Mailbox is not allowed, and has been aborted.');
|
Log::error('The creation of a Customer with no link to a Mailbox is not allowed, and has been aborted.');
|
||||||
// TODO: Error out more gracefully.
|
// TODO: Error out more gracefully.
|
||||||
|
|
Loading…
Reference in a new issue