From b89ee61bbab2c3299eb0699c7e5723088afc3887 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Aug 2020 23:53:33 +1000 Subject: [PATCH 1/2] return appropriate response from within catch --- app/Http/Controllers/SelfUpdateController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index bfa265cdd261..a50e553b9a3d 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -79,6 +79,8 @@ class SelfUpdateController extends BaseController } catch(GitException $e) { info($e->getMessage()); + return response()->json(['message'=>$e->getMessage()], 500); + } info("Are there any changes to pull? " . $repo->hasChanges()); From c245125be4d3d5c034e12af4acce83353643dadd Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 5 Aug 2020 10:12:47 +1000 Subject: [PATCH 2/2] Force remove stale contacts --- app/Jobs/Util/Import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 4f7de793674a..f353f22276f2 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -392,6 +392,8 @@ class Import implements ShouldQueue ) ); + $client->contacts()->forceDelete(); + if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json $modified_contacts = $resource['contacts']; @@ -403,9 +405,11 @@ class Import implements ShouldQueue unset($modified_contacts[$key]['id']); } + $saveable_contacts['contacts'] = $modified_contacts; $contact_repository->save($saveable_contacts, $client); + } $key = "clients_{$resource['id']}";