From 5076b8c70c1a27c5d5367da5feb5b3ac47e96e15 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 15 Feb 2021 11:49:34 +1100 Subject: [PATCH] Notification cleanup --- .../Admin/EntitySentNotification.php | 33 ----- app/Notifications/Ninja/NewAccountCreated.php | 2 + app/Notifications/Ninja/VerifyUser.php | 1 + app/Notifications/SendGenericNotification.php | 124 ------------------ 4 files changed, 3 insertions(+), 157 deletions(-) delete mode 100644 app/Notifications/SendGenericNotification.php diff --git a/app/Notifications/Admin/EntitySentNotification.php b/app/Notifications/Admin/EntitySentNotification.php index 53dc0e75d73a..dd628e14bfcf 100644 --- a/app/Notifications/Admin/EntitySentNotification.php +++ b/app/Notifications/Admin/EntitySentNotification.php @@ -77,39 +77,6 @@ class EntitySentNotification extends Notification implements ShouldQueue */ public function toMail($notifiable) { - //@TODO THESE ARE @DEPRECATED NOW we are now using app/Mail/Admin/* - $amount = Number::formatMoney($this->entity->amount, $this->entity->client); - $subject = ctrans( - "texts.notification_{$this->entity_name}_sent_subject", - [ - 'client' => $this->contact->present()->name(), - 'invoice' => $this->entity->number, - ] - ); - - $data = [ - 'title' => $subject, - 'message' => ctrans( - "texts.notification_{$this->entity_name}_sent", - [ - 'amount' => $amount, - 'client' => $this->contact->present()->name(), - 'invoice' => $this->entity->number, - ] - ), - 'url' => $this->invitation->getAdminLink(), - 'button' => ctrans("texts.view_{$this->entity_name}"), - 'signature' => $this->settings->email_signature, - 'logo' => $this->company->present()->logo(), - 'settings' => $this->settings, - ]; - - return (new MailMessage) - ->subject($subject) - ->markdown('email.admin.generic', $data) - ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->company->company_key); - }); } /** diff --git a/app/Notifications/Ninja/NewAccountCreated.php b/app/Notifications/Ninja/NewAccountCreated.php index cf9fd28a488d..bc558ba7c6da 100644 --- a/app/Notifications/Ninja/NewAccountCreated.php +++ b/app/Notifications/Ninja/NewAccountCreated.php @@ -20,6 +20,8 @@ use Illuminate\Notifications\Notification; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; + +//@deprecated class NewAccountCreated extends Notification { // use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; diff --git a/app/Notifications/Ninja/VerifyUser.php b/app/Notifications/Ninja/VerifyUser.php index 2bd267f68f45..bfb79d70d402 100644 --- a/app/Notifications/Ninja/VerifyUser.php +++ b/app/Notifications/Ninja/VerifyUser.php @@ -19,6 +19,7 @@ use Illuminate\Notifications\Notification; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +//@deprecated class VerifyUser extends Notification { // use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; diff --git a/app/Notifications/SendGenericNotification.php b/app/Notifications/SendGenericNotification.php deleted file mode 100644 index eff2a8d1e334..000000000000 --- a/app/Notifications/SendGenericNotification.php +++ /dev/null @@ -1,124 +0,0 @@ -entity = $invitation->{$entity_string}; - $this->contact = $invitation->contact; - $this->settings = $this->entity->client->getMergedSettings(); - $this->subject = $subject; - $this->body = $body; - $this->invitation = $invitation; - $this->entity_string = $entity_string; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * @return array - */ - public function via($notifiable) - { - return ['mail']; - } - - /** - * Get the mail representation of the notification. - * - * @param mixed $notifiable - * @return MailMessage - */ - public function toMail($notifiable) - { - $mail_message = (new MailMessage) - ->withSwiftMessage(function ($message) { - $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); - })->markdown($this->getTemplateView(), $this->buildMailMessageData()); - //})->markdown('email.template.plain', $this->buildMailMessageData()); - - $mail_message = $this->buildMailMessageSettings($mail_message); - - return $mail_message; - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * @return array - */ - public function toArray($notifiable) - { - return [ - // - ]; - } - - public function toSlack($notifiable) - { - return ''; - // $logo = $this->company->present()->logo(); - // $amount = Number::formatMoney($this->invoice->amount, $this->invoice->client); - - // return (new SlackMessage) - // ->success() - // ->from(ctrans('texts.notification_bot')) - // ->image($logo) - // ->content(ctrans( - // 'texts.notification_invoice_viewed', - // [ - // 'amount' => $amount, - // 'client' => $this->contact->present()->name(), - // 'invoice' => $this->invoice->number - // ] - // )); - } -}