Skip to content

Commit 801283f

Browse files
committed
By preference, show the same email for a logged-in user as his login, if it
exists; otherwise show the newest active email address. - Legacy-Id: 6644
1 parent f029c88 commit 801283f

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

ietf/nomcom/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@ def get_year_by_nomcom(nomcom):
6161

6262

6363
def get_user_email(user):
64-
emails = Email.objects.filter(person__user=user)
65-
mail = emails and emails[0] or None
66-
return mail
64+
emails = user.person.email_set.filter(active=True).order_by('-time')
65+
if emails:
66+
for email in emails:
67+
if email.address == user.username:
68+
return email
69+
return emails[0]
70+
return None
6771

6872

6973
def is_nomcom_member(user, nomcom):

0 commit comments

Comments
 (0)