From ba20a678737c0ca84382826f1a7bd22cc40fe4eb Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 31 Oct 2008 00:41:28 +0000 Subject: [PATCH] Added an option to turn user Gravatars on or off * Option can be found in Administration > General, called "Use Gravatar user icons" * Defaulting Gravatars to off * Added a helper gravatar_for_mail to check the setting before rendering the Gravatar. #1776 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1972 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 6 ++++++ app/views/account/show.rhtml | 4 ++-- app/views/issues/_history.rhtml | 2 +- app/views/issues/show.rhtml | 4 ++-- app/views/projects/activity.rhtml | 6 +++--- app/views/settings/_general.rhtml | 3 +++ app/views/users/list.rhtml | 2 +- config/settings.yml | 3 ++- lang/en.yml | 1 + 9 files changed, 21 insertions(+), 10 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 556b9551f..b944a4a00 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -561,6 +561,12 @@ module ApplicationHelper (@has_content && @has_content[name]) || false end + def gravatar_for_mail(mail, options = { }) + if Setting.gravatar_enabled? + return gravatar(mail, options) rescue nil + end + end + private def wiki_helper diff --git a/app/views/account/show.rhtml b/app/views/account/show.rhtml index 64fb8bf5f..305629a9c 100644 --- a/app/views/account/show.rhtml +++ b/app/views/account/show.rhtml @@ -2,7 +2,7 @@ <%= link_to(l(:button_edit), {:controller => 'users', :action => 'edit', :id => @user}, :class => 'icon icon-edit') if User.current.admin? %> -

<%= gravatar @user.mail unless @user.mail.empty? %> <%=h @user.name %>

+

<%= gravatar_for_mail @user.mail unless @user.mail.empty? %> <%=h @user.name %>

<%= mail_to(h(@user.mail)) unless @user.pref.hide_mail %> @@ -29,4 +29,4 @@

<%=l(:label_activity)%>

<%=l(:label_reported_issues)%>: <%= Issue.count(:conditions => ["author_id=?", @user.id]) %> -

\ No newline at end of file +

diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml index 65b34d7c5..e65c4d4d6 100644 --- a/app/views/issues/_history.rhtml +++ b/app/views/issues/_history.rhtml @@ -4,7 +4,7 @@

<%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %>
<%= content_tag('a', '', :name => "note-#{journal.indice}")%> <%= format_time(journal.created_on) %> - <%= journal.user.name %>

- <%= gravatar(journal.user.mail.blank? ? "" : journal.user.mail, :size => "32") %> + <%= gravatar_for_mail(journal.user.mail.blank? ? "" : journal.user.mail, :size => "32") %>