Show More
@@ -38,7 +38,6 b' from webhelpers.html.tags import _set_in' | |||||
38 | from rhodecode.lib.annotate import annotate_highlight |
|
38 | from rhodecode.lib.annotate import annotate_highlight | |
39 | from rhodecode.lib.utils import repo_name_slug |
|
39 | from rhodecode.lib.utils import repo_name_slug | |
40 | from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe |
|
40 | from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe | |
41 |
|
||||
42 | from rhodecode.lib.markup_renderer import MarkupRenderer |
|
41 | from rhodecode.lib.markup_renderer import MarkupRenderer | |
43 |
|
42 | |||
44 | def _reset(name, value=None, id=NotGiven, type="reset", **attrs): |
|
43 | def _reset(name, value=None, id=NotGiven, type="reset", **attrs): | |
@@ -288,15 +287,50 b' flash = _Flash()' | |||||
288 | #============================================================================== |
|
287 | #============================================================================== | |
289 | from vcs.utils import author_name, author_email |
|
288 | from vcs.utils import author_name, author_email | |
290 | from rhodecode.lib import credentials_filter, age as _age |
|
289 | from rhodecode.lib import credentials_filter, age as _age | |
|
290 | from rhodecode.model.db import User | |||
291 |
|
291 | |||
292 | age = lambda x:_age(x) |
|
292 | age = lambda x:_age(x) | |
293 | capitalize = lambda x: x.capitalize() |
|
293 | capitalize = lambda x: x.capitalize() | |
294 | email = author_email |
|
294 | email = author_email | |
295 | email_or_none = lambda x: email(x) if email(x) != x else None |
|
|||
296 | person = lambda x: author_name(x) |
|
295 | person = lambda x: author_name(x) | |
297 | short_id = lambda x: x[:12] |
|
296 | short_id = lambda x: x[:12] | |
298 | hide_credentials = lambda x: ''.join(credentials_filter(x)) |
|
297 | hide_credentials = lambda x: ''.join(credentials_filter(x)) | |
299 |
|
298 | |||
|
299 | ||||
|
300 | def email_or_none(x): | |||
|
301 | if email(x) != '': | |||
|
302 | return email(x) | |||
|
303 | ||||
|
304 | # See if it contains a username we can get an email from | |||
|
305 | user = User.get_by_username(author_name(x), case_insensitive=True, | |||
|
306 | cache=True) | |||
|
307 | if user is not None: | |||
|
308 | return user.email | |||
|
309 | ||||
|
310 | # No valid email, not a valid user in the system, none! | |||
|
311 | return None | |||
|
312 | ||||
|
313 | def person(x): | |||
|
314 | # Valid email in the attribute passed, see if they're in the system | |||
|
315 | ||||
|
316 | # attr to return from fetched user | |||
|
317 | person_getter = lambda usr: usr.username | |||
|
318 | ||||
|
319 | if email(x) != '': | |||
|
320 | user = User.get_by_email(email(x), case_insensitive=True, cache=True) | |||
|
321 | if user is not None: | |||
|
322 | return person_getter(user) | |||
|
323 | return email(x) | |||
|
324 | ||||
|
325 | # Maybe it's a username? | |||
|
326 | user = User.get_by_username(author_name(x), case_insensitive=True, | |||
|
327 | cache=True) | |||
|
328 | if user is not None: | |||
|
329 | return person_getter(user) | |||
|
330 | ||||
|
331 | # Still nothing? Just pass back the author name then | |||
|
332 | return author_name(x) | |||
|
333 | ||||
300 | def bool2icon(value): |
|
334 | def bool2icon(value): | |
301 | """Returns True/False values represented as small html image of true/false |
|
335 | """Returns True/False values represented as small html image of true/false | |
302 | icons |
|
336 | icons |
@@ -54,8 +54,7 b'' | |||||
54 | <div class="gravatar"> |
|
54 | <div class="gravatar"> | |
55 | <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),16)}"/> |
|
55 | <img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),16)}"/> | |
56 | </div> |
|
56 | </div> | |
57 |
<div title="${ |
|
57 | <div title="${cs.author}" class="user">${h.person(cs.author)}</div> | |
58 | ##<span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/> |
|
|||
59 | </div> |
|
58 | </div> | |
60 | <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div> |
|
59 | <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div> | |
61 | </div> |
|
60 | </div> |
@@ -64,7 +64,7 b'' | |||||
64 | <div class="gravatar"> |
|
64 | <div class="gravatar"> | |
65 | <img alt="gravatar" src="${h.gravatar_url(h.email(c.cs.author),16)}"/> |
|
65 | <img alt="gravatar" src="${h.gravatar_url(h.email(c.cs.author),16)}"/> | |
66 | </div> |
|
66 | </div> | |
67 |
<div title="${ |
|
67 | <div title="${c.cs.author}" class="user">${h.person(c.cs.author)}</div> | |
68 | </div> |
|
68 | </div> | |
69 | <div class="commit">${c.file.last_changeset.message}</div> |
|
69 | <div class="commit">${c.file.last_changeset.message}</div> | |
70 | </div> |
|
70 | </div> |
@@ -96,7 +96,9 b'' | |||||
96 | </td> |
|
96 | </td> | |
97 | <td> |
|
97 | <td> | |
98 | %if node.is_file(): |
|
98 | %if node.is_file(): | |
99 | ${node.last_changeset.author} |
|
99 | <span title="${node.last_changeset.author}"> | |
|
100 | ${h.person(node.last_changeset.author)} | |||
|
101 | </span> | |||
100 | %endif |
|
102 | %endif | |
101 | </td> |
|
103 | </td> | |
102 | </tr> |
|
104 | </tr> |
@@ -35,7 +35,7 b'' | |||||
35 | <div class="gravatar"> |
|
35 | <div class="gravatar"> | |
36 | <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),16)}"/> |
|
36 | <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),16)}"/> | |
37 | </div> |
|
37 | </div> | |
38 |
<div title="${ |
|
38 | <div title="${c.changeset.author}" class="user">${h.person(c.changeset.author)}</div> | |
39 | </div> |
|
39 | </div> | |
40 | <div class="commit">${c.file.last_changeset.message}</div> |
|
40 | <div class="commit">${c.file.last_changeset.message}</div> | |
41 | </div> |
|
41 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now