Skip to content

Commit 23f6bd7

Browse files
authored
Merge pull request #6114 from LibreSign/fix/email-notification-without-account
fix: check activity settings only when user account exists
2 parents ce39b11 + 3277ae6 commit 23f6bd7

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

lib/Listener/MailNotifyListener.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,27 @@ protected function sendSignMailNotification(
6060
if ($identifyMethod->getEntity()->isDeletedAccount()) {
6161
return;
6262
}
63-
if ($this->isNotificationDisabledAtActivity($identifyMethod->getEntity()->getIdentifierValue(), SendSignNotificationEvent::FILE_TO_SIGN)) {
64-
return;
65-
}
6663
$email = '';
6764
if ($identifyMethod->getName() === 'account') {
65+
$userId = $identifyMethod->getEntity()->getIdentifierValue();
6866
$email = $this->userManager
69-
->get($identifyMethod->getEntity()->getIdentifierValue())
67+
->get($userId)
7068
->getEMailAddress();
7169
} elseif ($identifyMethod->getName() === 'email') {
7270
$email = $identifyMethod->getEntity()->getIdentifierValue();
7371
}
7472
if (empty($email)) {
7573
return;
7674
}
75+
76+
$users = $this->userManager->getByEmail($email);
77+
if (count($users) === 1) {
78+
$userId = $users[0]->getUID();
79+
if ($this->isNotificationDisabledAtActivity($userId, SendSignNotificationEvent::FILE_TO_SIGN)) {
80+
return;
81+
}
82+
}
83+
7784
$isFirstNotification = $this->signRequestMapper->incrementNotificationCounter($signRequest, 'mail');
7885
if ($isFirstNotification) {
7986
$this->mail->notifyUnsignedUser($signRequest, $email);

0 commit comments

Comments
 (0)