mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Limit bulk emailing
This commit is contained in:
parent
0da944a887
commit
3906c13c77
@ -206,9 +206,11 @@ class InvoiceApiController extends BaseAPIController
|
||||
$invoice = $recurringInvoice;
|
||||
}
|
||||
$reminder = isset($data['email_type']) ? $data['email_type'] : false;
|
||||
if (auth()->user()->isTrusted()) {
|
||||
$this->dispatch(new SendInvoiceEmail($invoice, auth()->user()->id, $reminder));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$invoice = Invoice::scope($invoice->public_id)
|
||||
->with('client', 'invoice_items', 'invitations')
|
||||
@ -337,6 +339,10 @@ class InvoiceApiController extends BaseAPIController
|
||||
|
||||
public function emailInvoice(InvoiceRequest $request)
|
||||
{
|
||||
if (! auth()->user()->isTrusted()) {
|
||||
return $this->errorResponse('Requires paid pro plan', 400);
|
||||
}
|
||||
|
||||
$invoice = $request->entity();
|
||||
|
||||
if ($invoice->is_recurring && $recurringInvoice = $this->invoiceRepo->createRecurringInvoice($invoice)) {
|
||||
|
@ -138,8 +138,12 @@ class User extends Authenticatable
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function isPaidPro()
|
||||
public function isTrusted()
|
||||
{
|
||||
if (Utils::isSelfHost()) {
|
||||
true;
|
||||
}
|
||||
|
||||
return $this->account->isPro() && ! $this->account->isTrial();
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ class InvoiceDatatable extends EntityDatatable
|
||||
'label' => mtrans($this->entityType, 'download_' . $this->entityType),
|
||||
'url' => 'javascript:submitForm_'.$this->entityType.'("download")',
|
||||
];
|
||||
if (Utils::isSelfHost() || auth()->user()->isPaidPro()) {
|
||||
if (auth()->user()->isTrusted()) {
|
||||
$actions[] = [
|
||||
'label' => mtrans($this->entityType, 'email_' . $this->entityType),
|
||||
'url' => 'javascript:submitForm_'.$this->entityType.'("emailInvoice")',
|
||||
|
Loading…
Reference in New Issue
Block a user