Compare commits

..

No commits in common. "d61183c0a822aecd12574239a63d8f9061ed9178" and "4207b8093cbd23f939e58e09c3093454e3b448c2" have entirely different histories.

6 changed files with 10 additions and 34 deletions

View file

@ -1,8 +1,3 @@
1.1.1
* Fix the ability to start new Conversations.
* Log an explicit error when creating a new Conversation is aborted.
1.1.0
* Add compatibility with MMFCustomersGroups.

View file

@ -59,7 +59,6 @@ class Customer extends BaseCustomer {
::where('id', '=', $id)
->whereIn('mailbox_id', $mailboxes)
->first($columns);
return $customer;
}
/**

View file

@ -6,16 +6,11 @@
namespace Modules\MMFRestrictedCustomers\Providers;
use Eventy;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Eventy;
use App\User;
use Modules\MMFRestrictedCustomers\Console\Commands\FetchEmails;
use Modules\MMFRestrictedCustomers\Entities\Customer;
class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
/**
@ -62,26 +57,13 @@ class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
Eventy::addAction(
'customer.set_data',
function($customer, $data, $replace_data) {
if ( array_key_exists('mailbox', $data) ) {
if ( isset($data['mailbox']) ) {
// TODO: Check that the current user is allowed to access this Mailbox.
$data['mailbox_id'] = $data['mailbox'];
unset($data['mailbox']);
}
if ( array_key_exists('mailbox_id', $data) ) {
$customer->mailbox_id = $data['mailbox_id'];
} 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 ) {
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.
abort(500, 'The creation of a Customer with no link to a Mailbox is not allowed, and has been aborted.');
}
}
// TODO: Throw an error if the Mailbox is not set.
$customer->mailbox_id = $data['mailbox_id'];
},
$priority = 20,
$arguments = 3

View file

@ -33,11 +33,11 @@ So it is highly recommended to backup your customers database:
Download the [release tarball] and extract its content into `Modules/MMFRestrictedCustomers`.
[release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/1.1.1.tar.gz
[release tarball]: https://port.numenaute.org/MMF/freescout-restricted-customers/archive/1.1.0.tar.gz
```
wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/1.1.1.tar.gz -O freescout-restricted-customers-1.1.1.tar.gz
tar xf freescout-restricted-customers-1.1.1.tar.gz -C Modules
wget https://port.numenaute.org/MMF/freescout-restricted-customers/archive/1.1.0.tar.gz -O freescout-restricted-customers-1.1.0.tar.gz
tar xf freescout-restricted-customers-1.1.0.tar.gz -C Modules
mv Modules/freescout-restricted-customers Modules/MMFRestrictedCustomers
```

View file

@ -1,7 +1,7 @@
{
"name": "millions-missing-france/freescout-restricted-customers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "1.1.1",
"version": "1.1.0",
"type": "library",
"license": ["AGPL-3.0-only"],
"authors": [

View file

@ -2,7 +2,7 @@
"name": "MMFRestrictedCustomers",
"alias": "mmfrestrictedcustomers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "1.1.1",
"version": "1.1.0",
"detailsUrl": "",
"author": "Millions Missing FRANCE",
"authorUrl": "info@millionsmissing.fr",