Skip to content

Commit cfbf725

Browse files
fix: check activity settings only when user account exists
When identification method is email and person has no account, notification was being blocked by activity check for non-existent user. Now checks if user exists before verifying activity notification settings. Signed-off-by: Vitor Mattos <[email protected]>
1 parent ae3894b commit cfbf725

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
@@ -59,20 +59,27 @@ protected function sendSignMailNotification(
5959
if ($identifyMethod->getEntity()->isDeletedAccount()) {
6060
return;
6161
}
62-
if ($this->isNotificationDisabledAtActivity($identifyMethod->getEntity()->getIdentifierValue(), SendSignNotificationEvent::FILE_TO_SIGN)) {
63-
return;
64-
}
6562
$email = '';
6663
if ($identifyMethod->getName() === 'account') {
64+
$userId = $identifyMethod->getEntity()->getIdentifierValue();
6765
$email = $this->userManager
68-
->get($identifyMethod->getEntity()->getIdentifierValue())
66+
->get($userId)
6967
->getEMailAddress();
7068
} elseif ($identifyMethod->getName() === 'email') {
7169
$email = $identifyMethod->getEntity()->getIdentifierValue();
7270
}
7371
if (empty($email)) {
7472
return;
7573
}
74+
75+
$users = $this->userManager->getByEmail($email);
76+
if (count($users) === 1) {
77+
$userId = $users[0]->getUID();
78+
if ($this->isNotificationDisabledAtActivity($userId, SendSignNotificationEvent::FILE_TO_SIGN)) {
79+
return;
80+
}
81+
}
82+
7683
$isFirstNotification = $this->signRequestMapper->incrementNotificationCounter($signRequest, 'mail');
7784
if ($isFirstNotification) {
7885
$this->mail->notifyUnsignedUser($signRequest, $email);

0 commit comments

Comments
 (0)