From 438fb53ff572bf8be4234025d60b6d35570938e8 Mon Sep 17 00:00:00 2001 From: Habu Date: Wed, 20 Nov 2024 21:45:43 +0100 Subject: [PATCH] Only run nextcloud code on production from the GroupObserver --- app/Observers/GroupObserver.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Observers/GroupObserver.php b/app/Observers/GroupObserver.php index d417cdf..f5c4bb5 100644 --- a/app/Observers/GroupObserver.php +++ b/app/Observers/GroupObserver.php @@ -13,11 +13,11 @@ class GroupObserver { public function created(Group $group) { - if (App::isLocal()) { + if (! App::isProduction()) { return; } - if ($group->type === GroupTypeEnum::Team && $group->parent->nextcloud_folder_id) { + if ($group->type === GroupTypeEnum::Team && $group->parent?->nextcloud_folder_id) { NextcloudService::createGroup($group->hashid); // Parent->name / Group->name NextcloudService::setDisplayName($group->hashid, $group->parent->name.' / '.$group->name); @@ -34,7 +34,7 @@ public function created(Group $group) public function updated(Group $group): void { - if (App::isLocal()) { + if (! App::isProduction()) { return; } @@ -70,7 +70,7 @@ public function updated(Group $group): void public function deleted(Group $group) { - if (App::isLocal()) { + if (! App::isProduction()) { return; }