From 4131f83ce602425b06678d5f8ff0716c8f2aed68 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 2 Jul 2022 14:49:01 +1000 Subject: [PATCH 1/3] Additional translations --- resources/lang/en/texts.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index bf7353d75fb9..4c9df86e6ac1 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4633,6 +4633,7 @@ $LANG = array( 'vendor_information' => 'Vendor Information', 'notification_purchase_order_accepted_subject' => 'Purchase Order :purchase_order was accepted by :vendor', 'notification_purchase_order_accepted' => 'The following vendor :vendor accepted Purchase Order :purchase_order for :amount.', + 'amount_received' => 'Amount received', ); return $LANG; From f592af1469aeacd581b339b01c95854609ca7ce1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 3 Jul 2022 08:54:22 +1000 Subject: [PATCH 2/3] email quality --- .../Ninja/EmailQualityNotification.php | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 app/Notifications/Ninja/EmailQualityNotification.php diff --git a/app/Notifications/Ninja/EmailQualityNotification.php b/app/Notifications/Ninja/EmailQualityNotification.php new file mode 100644 index 000000000000..2dde02e490ff --- /dev/null +++ b/app/Notifications/Ninja/EmailQualityNotification.php @@ -0,0 +1,88 @@ +company = $company; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * @return array + */ + public function via($notifiable) + { + return ['slack']; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * @return MailMessage + */ + public function toMail($notifiable) + { + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } + + public function toSlack($notifiable) + { + + $content = "Email Quality notification for Company {$this->company->company_key} \n"; + + $owner = $this->company->owner(); + + $content .= "Owner {$owner->present()->name() } | {$owner->email}"; + + return (new SlackMessage) + ->success() + ->from(ctrans('texts.notification_bot')) + ->image('https://app.invoiceninja.com/favicon.png') + ->content($content); + } +} From 866dd58b03252ee0e145464abcfcfe494a6e21e7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 3 Jul 2022 10:21:54 +1000 Subject: [PATCH 3/3] email quality --- app/Models/Account.php | 2 +- app/Notifications/Ninja/EmailQualityNotification.php | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index cd849b4efacc..04c254919e57 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -33,7 +33,7 @@ class Account extends BaseModel use PresentableTrait; use MakesHash; - private $free_plan_email_quota = 100; + private $free_plan_email_quota = 50; private $paid_plan_email_quota = 500; /** diff --git a/app/Notifications/Ninja/EmailQualityNotification.php b/app/Notifications/Ninja/EmailQualityNotification.php index 2dde02e490ff..2c852f7acb67 100644 --- a/app/Notifications/Ninja/EmailQualityNotification.php +++ b/app/Notifications/Ninja/EmailQualityNotification.php @@ -11,6 +11,7 @@ namespace App\Notifications\Ninja; +use App\Models\Company; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; @@ -29,11 +30,14 @@ class EmailQualityNotification extends Notification * @return void */ - protected $company; + protected Company $company; - public function __construct($company) + protected string $spam_string; + + public function __construct(Company $company, string $spam_string) { $this->company = $company; + $this->spam_string = $spam_string; } /** @@ -77,7 +81,8 @@ class EmailQualityNotification extends Notification $owner = $this->company->owner(); - $content .= "Owner {$owner->present()->name() } | {$owner->email}"; + $content .= "Owner {$owner->present()->name() } | {$owner->email} \n"; + $content .= "Spam trigger: {$this->spam_string}"; return (new SlackMessage) ->success()