# HG changeset patch # User lisaq # Date 2016-07-07 12:39:18 # Node ID 1a0e6c3511e5d211a291162bf5fcdda2cb45135b # Parent 71302d468ad15220dc84aa6ad256dae6b8c3f6af ux: adjust email_or_none so that it does not swap emails diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -772,19 +772,17 @@ def discover_user(author): def email_or_none(author): # extract email from the commit string _email = author_email(author) + + # If we have an email, use it, otherwise + # see if it contains a username we can get an email from if _email != '': - # check it against RhodeCode database, and use the MAIN email for this - # user - user = User.get_by_email(_email, case_insensitive=True, cache=True) - if user is not None: - return user.email return _email - - # See if it contains a username we can get an email from - user = User.get_by_username(author_name(author), case_insensitive=True, + else: + user = User.get_by_username(author_name(author), case_insensitive=True, cache=True) + if user is not None: - return user.email + return user.email # No valid email, not a valid user in the system, none! return None