From 3df49b04ed603a9bf15e60e3002b244c0d6cfe4d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 14 Dec 2022 09:25:05 +1100 Subject: [PATCH] Watch webhooks on hosted --- app/Jobs/Util/WebhookHandler.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Util/WebhookHandler.php b/app/Jobs/Util/WebhookHandler.php index 46ac62d4f713..31083d9cfbef 100644 --- a/app/Jobs/Util/WebhookHandler.php +++ b/app/Jobs/Util/WebhookHandler.php @@ -17,6 +17,7 @@ use App\Models\Client as ClientModel; use App\Models\SystemLog; use App\Models\Webhook; use App\Transformers\ArraySerializer; +use App\Utils\Ninja; use GuzzleHttp\Client; use GuzzleHttp\RequestOptions; use Illuminate\Bus\Queueable; @@ -65,11 +66,12 @@ class WebhookHandler implements ShouldQueue * @return bool */ public function handle() - {//todo set multidb here + { MultiDB::setDb($this->company->db); - if (! $this->company || $this->company->is_disabled) { + //If the company is disabled, or if on hosted, the user is not a paid hosted user return early + if (! $this->company || $this->company->is_disabled || (Ninja::isHosted() && !$this->company->account->isPaidHostedClient())) { return true; }