From ad7889b76925ea62f328ba0f961b6ced893d5127 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 1 Aug 2022 17:17:06 +1000 Subject: [PATCH] Clean up for spam notifications --- app/Notifications/Ninja/SpamNotification.php | 22 ++++++++++--------- .../Notification/NotificationService.php | 1 - 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/Notifications/Ninja/SpamNotification.php b/app/Notifications/Ninja/SpamNotification.php index 061c720e38..9c85bb1565 100644 --- a/app/Notifications/Ninja/SpamNotification.php +++ b/app/Notifications/Ninja/SpamNotification.php @@ -29,7 +29,7 @@ class SpamNotification extends Notification * @return void */ - protected array $spam_list; + public array $spam_list; public function __construct($spam_list) { @@ -74,43 +74,45 @@ class SpamNotification extends Notification { $content = ''; - foreach($this->spam_list as $spam_list) - { + // foreach($this->spam_lists as $spam_list) + // { - if(array_key_exists('companies', $spam_list)) + if(array_key_exists('companies', $this->spam_list)) { $content .= " Companies \n"; - foreach($spam_list['companies'] as $company) + foreach($this->spam_list['companies'] as $company) { $content .= "{$company['name']} - c_key={$company['company_key']} - a_key={$company['account_key']} - {$company['owner']} \n"; } } - if(array_key_exists('templates', $spam_list)) + if(array_key_exists('templates', $this->spam_list)) { $content .= " Templates \n"; - foreach($spam_list['templates'] as $company) + foreach($this->spam_list['templates'] as $company) { $content .= "{$company['name']} - c_key={$company['company_key']} - a_key={$company['account_key']} - {$company['owner']} \n"; } } - if(array_key_exists('users', $spam_list)) + if(array_key_exists('users', $this->spam_list)) { $content .= ' Users \n'; - foreach($spam_list['users'] as $user) + foreach($this->spam_list['users'] as $user) { $content .= "{$user['email']} - a_key={$user['account_key']} - created={$user['created']} \n"; } } - } + // } + + return (new SlackMessage) ->success() diff --git a/app/Services/Notification/NotificationService.php b/app/Services/Notification/NotificationService.php index 63022d21c3..c4d44b620e 100644 --- a/app/Services/Notification/NotificationService.php +++ b/app/Services/Notification/NotificationService.php @@ -70,7 +70,6 @@ class NotificationService extends AbstractService public function ninja() { Notification::route('slack', config('ninja.notification.slack')) - ->route('mail', config('ninja.notification.mail')) ->notify($this->notification); } }