1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixes for hosted email quota logic

This commit is contained in:
David Bomba 2023-11-01 10:34:02 +11:00
parent 3269d0cd05
commit 3d50dea5e5
5 changed files with 10 additions and 10 deletions

View File

@ -493,9 +493,6 @@ class InvoiceController extends BaseController
return response(['message' => 'Please verify your account to send emails.'], 400);
}
/**@var \App\Models\User $user */
$user = auth()->user();
if(in_array($request->action, ['auto_bill','mark_paid']) && $user->cannot('create', \App\Models\Payment::class)) {
return response(['message' => ctrans('texts.not_authorized'), 'errors' => ['ids' => [ctrans('texts.not_authorized')]]], 422);
}

View File

@ -85,14 +85,14 @@ class NinjaMailerJob implements ShouldQueue
/* Serializing models from other jobs wipes the primary key */
$this->company = Company::query()->where('company_key', $this->nmo->company->company_key)->first();
/* Set the email driver */
$this->setMailDriver();
/* If any pre conditions fail, we return early here */
if (!$this->company || $this->preFlightChecksFail()) {
return;
}
/* Set the email driver */
$this->setMailDriver();
/* Run time we set Reply To Email*/
if (strlen($this->nmo->settings->reply_to_email) > 1) {
if (property_exists($this->nmo->settings, 'reply_to_name')) {
@ -513,7 +513,7 @@ class NinjaMailerJob implements ShouldQueue
}
/* GMail users are uncapped */
if (Ninja::isHosted() && ($this->nmo->settings->email_sending_method == 'gmail' || $this->nmo->settings->email_sending_method == 'office365')) {
if (Ninja::isHosted() && (in_array($this->nmo->settings->email_sending_method, ['gmail', 'office365', 'client_postmark', 'client_mailgun']))) {
return false;
}

View File

@ -87,6 +87,9 @@ class Email implements ShouldQueue
->setDefaults()
->buildMailable();
/** Ensure quota's on hosted platform are respected. :) */
$this->setMailDriver();
if ($this->preFlightChecksFail()) {
return;
}
@ -228,7 +231,7 @@ class Email implements ShouldQueue
*/
public function email()
{
$this->setMailDriver();
// $this->setMailDriver();
/* Init the mailer*/
$mailer = Mail::mailer($this->mailer);

View File

@ -31,7 +31,7 @@ return [
'company_id' => 0,
'hash_salt' => env('HASH_SALT', ''),
'currency_converter_api_key' => env('OPENEXCHANGE_APP_ID', ''),
'enabled_modules' => 32767,
'enabled_modules' => 65535,
'phantomjs_key' => env('PHANTOMJS_KEY', 'a-demo-key-with-low-quota-per-ip-address'),
'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', false),

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "@invoiceninja/invoiceninja",
"name": "invoiceninja",
"lockfileVersion": 2,
"requires": true,
"packages": {