mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
Avoid sending "user need confirmation" emails when there are no org admins (#1960)
This commit is contained in:
parent
244a33cdae
commit
de997a2246
@ -1405,10 +1405,15 @@ namespace Bit.Core.Services
|
||||
|
||||
await _organizationUserRepository.ReplaceAsync(orgUser);
|
||||
|
||||
await _mailService.SendOrganizationAcceptedEmailAsync(
|
||||
(await _organizationRepository.GetByIdAsync(orgUser.OrganizationId)),
|
||||
user.Email,
|
||||
(await _organizationUserRepository.GetManyByMinimumRoleAsync(orgUser.OrganizationId, OrganizationUserType.Admin)).Select(a => a.Email).Distinct());
|
||||
var admins = await _organizationUserRepository.GetManyByMinimumRoleAsync(orgUser.OrganizationId, OrganizationUserType.Admin);
|
||||
var adminEmails = admins.Select(a => a.Email).Distinct().ToList();
|
||||
|
||||
if (adminEmails.Count > 0)
|
||||
{
|
||||
var organization = await _organizationRepository.GetByIdAsync(orgUser.OrganizationId);
|
||||
await _mailService.SendOrganizationAcceptedEmailAsync(organization, user.Email, adminEmails);
|
||||
}
|
||||
|
||||
return orgUser;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user