##// END OF EJS Templates
ux: adjust email_or_none so that it does not swap emails
lisaq -
r409:1a0e6c35 default
parent child Browse files
Show More
@@ -772,19 +772,17 b' def discover_user(author):'
772 def email_or_none(author):
772 def email_or_none(author):
773 # extract email from the commit string
773 # extract email from the commit string
774 _email = author_email(author)
774 _email = author_email(author)
775
776 # If we have an email, use it, otherwise
777 # see if it contains a username we can get an email from
775 if _email != '':
778 if _email != '':
776 # check it against RhodeCode database, and use the MAIN email for this
777 # user
778 user = User.get_by_email(_email, case_insensitive=True, cache=True)
779 if user is not None:
780 return user.email
781 return _email
779 return _email
782
780 else:
783 # See if it contains a username we can get an email from
781 user = User.get_by_username(author_name(author), case_insensitive=True,
784 user = User.get_by_username(author_name(author), case_insensitive=True,
785 cache=True)
782 cache=True)
783
786 if user is not None:
784 if user is not None:
787 return user.email
785 return user.email
788
786
789 # No valid email, not a valid user in the system, none!
787 # No valid email, not a valid user in the system, none!
790 return None
788 return None
General Comments 0
You need to be logged in to leave comments. Login now