mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
Merge pull request #6114 from LibreSign/fix/email-notification-without-account
fix: check activity settings only when user account exists
This commit is contained in:
commit
23f6bd730b
1 changed files with 11 additions and 4 deletions
|
|
@ -60,13 +60,11 @@ class MailNotifyListener implements IEventListener {
|
|||
if ($identifyMethod->getEntity()->isDeletedAccount()) {
|
||||
return;
|
||||
}
|
||||
if ($this->isNotificationDisabledAtActivity($identifyMethod->getEntity()->getIdentifierValue(), SendSignNotificationEvent::FILE_TO_SIGN)) {
|
||||
return;
|
||||
}
|
||||
$email = '';
|
||||
if ($identifyMethod->getName() === 'account') {
|
||||
$userId = $identifyMethod->getEntity()->getIdentifierValue();
|
||||
$email = $this->userManager
|
||||
->get($identifyMethod->getEntity()->getIdentifierValue())
|
||||
->get($userId)
|
||||
->getEMailAddress();
|
||||
} elseif ($identifyMethod->getName() === 'email') {
|
||||
$email = $identifyMethod->getEntity()->getIdentifierValue();
|
||||
|
|
@ -74,6 +72,15 @@ class MailNotifyListener implements IEventListener {
|
|||
if (empty($email)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$users = $this->userManager->getByEmail($email);
|
||||
if (count($users) === 1) {
|
||||
$userId = $users[0]->getUID();
|
||||
if ($this->isNotificationDisabledAtActivity($userId, SendSignNotificationEvent::FILE_TO_SIGN)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$isFirstNotification = $this->signRequestMapper->incrementNotificationCounter($signRequest, 'mail');
|
||||
if ($isFirstNotification) {
|
||||
$this->mail->notifyUnsignedUser($signRequest, $email);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue