Skip to content

Commit

Permalink
Ignorign CUSTOMER entries in Google groups member list
Browse files Browse the repository at this point in the history
  • Loading branch information
Jnesselr committed Mar 2, 2024
1 parent 90ac705 commit 3a48139
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/External/Google/GroupApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand All @@ -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']);
});
Expand Down

0 comments on commit 3a48139

Please sign in to comment.