Bugfix: when allowMultipleIdentities is false always return primaryIdentity

This commit is contained in:
djmaze 2021-11-16 13:40:16 +01:00
parent 6ae38bfe1b
commit dff89ea4e0
2 changed files with 6 additions and 4 deletions

View file

@ -43,8 +43,8 @@ class Identity implements \JsonSerializable
function __construct(string $sId = '', string $sEmail = '')
{
$this->sId = empty($sId) ? '' : $sId;
$this->sEmail = empty($sEmail) ? '' : $sEmail;
$this->sId = $sId;
$this->sEmail = $sEmail;
$this->sName = '';
$this->sReplyTo = '';
$this->sBcc = '';

View file

@ -43,8 +43,10 @@ class Identities extends AbstractProvider
}));
// If no primary identity is found, generate default one from account info
if ($primaryIdentity === null || $primaryIdentity === false)
$identities[] = $primaryIdentity = new Identity('', $account->Email());
if ($primaryIdentity === null || $primaryIdentity === false) {
$primaryIdentity = $primaryIdentity = new Identity('', $account->Email());
$identities[] = $primaryIdentity;
}
// Return only primary identity or all identities
return $allowMultipleIdentities ? $identities : [$primaryIdentity];