From cbf8735d235998ba58a900adec5a5041866cb3f6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 5 Feb 2023 08:41:28 +1100 Subject: [PATCH] additional logging --- app/Http/Controllers/CompanyController.php | 2 +- app/Listeners/Subscription/AppStoreRenewSubscription.php | 2 ++ app/Notifications/Ninja/ClientAccountNotFound.php | 9 ++------- app/Observers/UserObserver.php | 4 ++-- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 1325c88564e8..092dc9d23082 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -494,7 +494,7 @@ class CompanyController extends BaseController $account->delete(); if (Ninja::isHosted()) { - \Modules\Admin\Jobs\Account\NinjaDeletedAccount::dispatch($account_key, $request->all()); + \Modules\Admin\Jobs\Account\NinjaDeletedAccount::dispatch($account_key, $request->all(), auth()->user()->email); } LightLogs::create(new AccountDeleted()) diff --git a/app/Listeners/Subscription/AppStoreRenewSubscription.php b/app/Listeners/Subscription/AppStoreRenewSubscription.php index aff9af2e84d7..456929d4f2d5 100644 --- a/app/Listeners/Subscription/AppStoreRenewSubscription.php +++ b/app/Listeners/Subscription/AppStoreRenewSubscription.php @@ -38,6 +38,8 @@ class AppStoreRenewSubscription implements ShouldQueue $inapp_transaction_id = $event->getSubscriptionId(); //$subscription_id + nlog("inapp upgrade processing for = {$inapp_transaction_id}"); + MultiDB::findAndSetDbByInappTransactionId($inapp_transaction_id); $account = Account::where('inapp_transaction_id', $inapp_transaction_id)->first(); diff --git a/app/Notifications/Ninja/ClientAccountNotFound.php b/app/Notifications/Ninja/ClientAccountNotFound.php index 2edddc242339..5a2418cedd2d 100644 --- a/app/Notifications/Ninja/ClientAccountNotFound.php +++ b/app/Notifications/Ninja/ClientAccountNotFound.php @@ -30,13 +30,7 @@ class ClientAccountNotFound extends Notification * @return void */ - - protected string $account_key; - - public function __construct(string $account_key) - { - $this->account_key = $account_key; - } + public function __construct(protected string $account_key, protected string $email){} /** * Get the notification's delivery channels. @@ -77,6 +71,7 @@ class ClientAccountNotFound extends Notification $content = "Client not found, unable to remove account\n"; $content .= "Account: {$this->account_key }\n"; + $content .= "Email: {$this->email}\n"; return (new SlackMessage) ->success() diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index 65dbbe65c59b..7efa008f74c8 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -39,10 +39,10 @@ class UserObserver public function updated(User $user) { - if (Ninja::isHosted() && $user->isDirty('email')) { + if (Ninja::isHosted() && $user->isDirty('email') && $user->company_users()->where('is_owner', true)->exists()) { //ensure they are owner user and update email on file. if(class_exists(\Modules\Admin\Jobs\Account\UpdateOwnerUser::class)) - \Modules\Admin\Jobs\Account\UpdateOwnerUser::dispatch($user->account->account_key, $user, $user->getOriginal('email')); + \Modules\Admin\Jobs\Account\UpdateOwnerUser::dispatch($user->account->key, $user, $user->getOriginal('email')); }