Mercurial > kallithea
changeset 2725:3853e37db97c beta
fixes issue #531, when extracting user email, we check it against the database,
and return user default email. Also if no email is present check the username
for matching targets.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 21 Aug 2012 19:36:21 +0200 |
parents | 29db53a79ab2 |
children | aa17c7a1b8a5 |
files | rhodecode/lib/helpers.py rhodecode/templates/changeset/changeset.html |
diffstat | 2 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rhodecode/lib/helpers.py Mon Aug 20 21:40:25 2012 +0200 +++ b/rhodecode/lib/helpers.py Tue Aug 21 19:36:21 2012 +0200 @@ -396,8 +396,14 @@ def email_or_none(author): + # extract email from the commit string _email = email(author) 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
--- a/rhodecode/templates/changeset/changeset.html Mon Aug 20 21:40:25 2012 +0200 +++ b/rhodecode/templates/changeset/changeset.html Tue Aug 21 19:36:21 2012 +0200 @@ -53,7 +53,7 @@ <div class="left"> <div class="author"> <div class="gravatar"> - <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/> + <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.changeset.author),20)}"/> </div> <span>${h.person(c.changeset.author)}</span><br/> <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>