Skip to content

Commit

Permalink
refactor adminalerts email address retrieval (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Apr 25, 2024
1 parent 83899f7 commit 4819bb7
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions adminalerts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Projectroles dependency
from projectroles.app_settings import AppSettingAPI
from projectroles.email import get_email_user, send_generic_mail
from projectroles.email import get_email_user, get_user_addr, send_generic_mail
from projectroles.views import (
LoggedInPermissionMixin,
HTTPRefererMixin,
Expand Down Expand Up @@ -105,16 +105,8 @@ def _get_email_recipients(cls, alert):
if not u.email:
logger.warning('No email set for user: {}'.format(u.username))
continue
if u.email not in ret:
ret.append(u.email)
alt_emails = app_settings.get(
'projectroles', 'user_email_additional', user=u
)
if not alt_emails:
continue
for e in alt_emails.split(';'):
if e not in ret:
ret.append(e)
user_emails = get_user_addr(u)
ret += [e for e in user_emails if e not in ret]
return ret

def _send_email(self, alert, action):
Expand Down

0 comments on commit 4819bb7

Please sign in to comment.