diff --git a/kallithea/lib/helpers.py b/kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py +++ b/kallithea/lib/helpers.py @@ -840,10 +840,13 @@ HasRepoGroupPermissionAny # GRAVATAR URL #============================================================================== def gravatar_div(email_address, cls='', size=30, **div_attributes): - """Return an html literal with a div around a gravatar. + """Return an html literal with a div around a gravatar if they are enabled. Extra keyword parameters starting with 'div_' will get the prefix removed and be used as attributes on the div. The default class is 'gravatar'. """ + from pylons import tmpl_context as c + if not c.visual.use_gravatar: + return '' if 'div_class' not in div_attributes: div_attributes['div_class'] = "gravatar" attributes = [] @@ -862,6 +865,10 @@ def gravatar(email_address, cls='', size empty then we fallback to using an icon. """ + from pylons import tmpl_context as c + if not c.visual.use_gravatar: + return '' + src = gravatar_url(email_address, size * 2) if src: diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js --- a/kallithea/public/js/base.js +++ b/kallithea/public/js/base.js @@ -1078,7 +1078,10 @@ var autocompleteHighlightMatch = functio // Return html snippet for showing the provided gravatar url var gravatar = function(gravatar_lnk, size, cssclass) { - if (!gravatar_lnk || gravatar_lnk == 'default') { + if (!gravatar_lnk) { + return ''; + } + if (gravatar_lnk == 'default') { return ''.format(size, cssclass); } return ''.format(size, gravatar_lnk, cssclass); @@ -1317,7 +1320,9 @@ var addReviewMember = function(id,fname, '
\n'+ ' \n'+ '
\n'+ - '
{0}
\n'+ + (gravatarelm ? + '
{0}
\n' : + '')+ '
{1}
\n'+ ' \n'+ '
\n'+ diff --git a/kallithea/templates/admin/my_account/my_account_emails.html b/kallithea/templates/admin/my_account/my_account_emails.html --- a/kallithea/templates/admin/my_account/my_account_emails.html +++ b/kallithea/templates/admin/my_account/my_account_emails.html @@ -1,7 +1,9 @@
+ %if c.visual.use_gravatar: + %endif + %if c.visual.use_gravatar: + %endif
${h.gravatar_div(c.user.email, size=16)} ${_('Primary')} @@ -10,7 +12,9 @@ %if c.user_email_map: %for em in c.user_email_map:
${h.gravatar_div(em.email, size=16)} ${h.form(url('my_account_emails'),method='delete')} diff --git a/kallithea/templates/admin/users/user_edit_emails.html b/kallithea/templates/admin/users/user_edit_emails.html --- a/kallithea/templates/admin/users/user_edit_emails.html +++ b/kallithea/templates/admin/users/user_edit_emails.html @@ -1,7 +1,9 @@
+ %if c.visual.use_gravatar: + %endif + %if c.visual.use_gravatar: + %endif
${h.gravatar_div(c.user.email, size=16)} ${_('Primary')} @@ -10,7 +12,9 @@ %if c.user_email_map: %for em in c.user_email_map:
${h.gravatar_div(c.user.email, size=16)} ${h.form(url('edit_user_emails', id=c.user.user_id),method='delete')} diff --git a/kallithea/templates/changeset/changeset_range.html b/kallithea/templates/changeset/changeset_range.html --- a/kallithea/templates/changeset/changeset_range.html +++ b/kallithea/templates/changeset/changeset_range.html @@ -39,7 +39,9 @@ ${self.repo_context_bar('changelog')} %for cnt,cs in enumerate(c.cs_ranges): + %if c.visual.use_gravatar: + %endif diff --git a/kallithea/templates/compare/compare_cs.html b/kallithea/templates/compare/compare_cs.html --- a/kallithea/templates/compare/compare_cs.html +++ b/kallithea/templates/compare/compare_cs.html @@ -52,7 +52,9 @@ + %if c.visual.use_gravatar: + %endif
${h.gravatar_div(h.email_or_none(cs.author), size=14)}${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}
${h.person(cs.author)}
${cs.date} ${cs.date}${h.gravatar_div(h.email_or_none(cs.author), size=14, div_commit_id="${cs.raw_id}")}
${h.person(cs.author)}
${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}