1
0
Fork 0
mirror of synced 2024-10-01 17:58:02 +13:00

Remove redundant key existence check

This commit is contained in:
Jake Barnby 2024-02-01 17:42:19 +13:00
parent 19fdc193b6
commit acc7131c95
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -158,6 +158,12 @@ App::post('/v1/messaging/providers/sendgrid')
->action(function (string $providerId, string $name, string $apiKey, string $fromName, string $fromEmail, string $replyToName, string $replyToEmail, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) {
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
$credentials = [];
if (!empty($apiKey)) {
$credentials['apiKey'] = $apiKey;
}
$options = [
'fromName' => $fromName,
'fromEmail' => $fromEmail,
@ -165,17 +171,10 @@ App::post('/v1/messaging/providers/sendgrid')
'replyToEmail' => $replyToEmail,
];
$credentials = [];
if (!empty($apiKey)) {
$credentials['apiKey'] = $apiKey;
}
if (
$enabled === true
&& !empty($fromEmail)
&& \array_key_exists('apiKey', $credentials)
&& \array_key_exists('fromEmail', $options)
) {
$enabled = true;
} else {