From 3a48139a8328fe26dee84f3b7cdf69af4e4835be Mon Sep 17 00:00:00 2001 From: Justin Nesselrotte Date: Sat, 2 Mar 2024 06:15:52 -0700 Subject: [PATCH] Ignorign CUSTOMER entries in Google groups member list --- app/External/Google/GroupApi.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/External/Google/GroupApi.php b/app/External/Google/GroupApi.php index 1bc9ed2..4eb644b 100644 --- a/app/External/Google/GroupApi.php +++ b/app/External/Google/GroupApi.php @@ -59,7 +59,7 @@ public function add(string $email) if ($response->getStatusCode() == Response::HTTP_CONFLICT && $this->errorsHasDuplicate($response)) { // Not an issue, they've already been added } elseif ($response->getStatusCode() != Response::HTTP_OK) { - throw new \Exception('Google api add failed: '.$response->getBody()); + throw new \Exception('Google api add failed: ' . $response->getBody()); } // TODO Handle conflict/other errors @@ -80,7 +80,7 @@ public function remove(string $email) // TODO Handle conflict/other errors } - public function list(ApiProgress $apiProgress) + public function list(?ApiProgress $apiProgress = null) { $accessToken = $this->tokenManager->getAccessToken(self::GROUP_SCOPE); @@ -94,6 +94,9 @@ public function list(ApiProgress $apiProgress) ], ]); }, $apiProgress) + ->filter(function($group) { + return $group['type'] != 'CUSTOMER'; // No email key for this entry type + }) ->map(function ($group) { return GmailEmailHelper::handleGmail($group['email']); });