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") %>
<% for detail in journal.details %>
<%= show_detail(detail) %>
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml
index 05996f2fa..15b7b050e 100644
--- a/app/views/issues/show.rhtml
+++ b/app/views/issues/show.rhtml
@@ -10,7 +10,7 @@
<%= @issue.tracker.name %> #<%= @issue.id %>
">
- <%= gravatar(@issue.author.mail, :size => "64") rescue nil %>
+ <%= gravatar_for_mail(@issue.author.mail, :size => "64") %>
<%=h @issue.subject %>
<%= authoring @issue.created_on, @issue.author %>.
@@ -27,7 +27,7 @@
<%=l(:field_due_date)%>: <%= format_date(@issue.due_date) %>
- <%=l(:field_assigned_to)%>: <%= gravatar(@issue.assigned_to.mail, :size => "14") unless @issue.assigned_to.blank?%><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %>
+ <%=l(:field_assigned_to)%>: <%= gravatar_for_mail(@issue.assigned_to.mail, :size => "14") unless @issue.assigned_to.blank?%><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %>
<%=l(:field_done_ratio)%>: <%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %>
diff --git a/app/views/projects/activity.rhtml b/app/views/projects/activity.rhtml
index 47d32e6a3..1c2591e09 100644
--- a/app/views/projects/activity.rhtml
+++ b/app/views/projects/activity.rhtml
@@ -7,9 +7,9 @@
<% @events_by_day[day].sort {|x,y| y.event_datetime <=> x.event_datetime }.each do |e| -%>
- <%= gravatar(e.user.mail, :size => "24") if e.respond_to?(:user) rescue nil%>
- <%= gravatar(e.author.mail, :size => "24") if e.respond_to?(:author) rescue nil%>
- <%= gravatar(e.committer.match('\\<.+?\\>')[0].gsub(/[<>]/, ''), :size => "24") if e.respond_to?(:committer) rescue nil%>
+ <%= gravatar_for_mail(e.user.mail, :size => "24") if e.respond_to?(:user) %>
+ <%= gravatar_for_mail(e.author.mail, :size => "24") if e.respond_to?(:author) %>
+ <%= gravatar_for_mail(e.committer.match('\\<.+?\\>')[0].gsub(/[<>]/, ''), :size => "24") if e.respond_to?(:committer) rescue nil %>
<%= format_time(e.event_datetime, false) %>
<%= content_tag('span', h(e.project), :class => 'project') if @project.nil? || @project != e.project %>
<%= link_to format_activity_title(e.event_title), e.event_url %>
diff --git a/app/views/settings/_general.rhtml b/app/views/settings/_general.rhtml
index f8d4e67fb..85b459720 100644
--- a/app/views/settings/_general.rhtml
+++ b/app/views/settings/_general.rhtml
@@ -46,6 +46,9 @@
<%= l(:setting_feeds_limit) %>
<%= text_field_tag 'settings[feeds_limit]', Setting.feeds_limit, :size => 6 %>
+
+<%= l(:setting_gravatar_enabled) %>
+<%= check_box_tag 'settings[gravatar_enabled]', 1, Setting.gravatar_enabled? %><%= hidden_field_tag 'settings[gravatar_enabled]', 0 %>
<%= submit_tag l(:button_save) %>
diff --git a/app/views/users/list.rhtml b/app/views/users/list.rhtml
index 69f64910a..2b1cd1449 100644
--- a/app/views/users/list.rhtml
+++ b/app/views/users/list.rhtml
@@ -29,7 +29,7 @@
<% for user in @users -%>
<%= %w(anon active registered locked)[user.status] %>">
- <%= gravatar(user.mail.blank? ? "" : user.mail, :size => "24") %><%= link_to h(user.login), :action => 'edit', :id => user %>
+ <%= gravatar_for_mail(user.mail.blank? ? "" : user.mail, :size => "24") %><%= link_to h(user.login), :action => 'edit', :id => user %>
<%= h(user.firstname) %>
<%= h(user.lastname) %>
<%= mail_to(h(user.mail)) %>
diff --git a/config/settings.yml b/config/settings.yml
index 7d6a9d1df..02f0b13b5 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -135,4 +135,5 @@ emails_footer:
default: |-
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://hostname/my/account
-
+gravatar_enabled:
+ default: 0
diff --git a/lang/en.yml b/lang/en.yml
index 01b1d1c3b..42c4e96a6 100644
--- a/lang/en.yml
+++ b/lang/en.yml
@@ -222,6 +222,7 @@ setting_enabled_scm: Enabled SCM
setting_mail_handler_api_enabled: Enable WS for incoming emails
setting_mail_handler_api_key: API key
setting_sequential_project_identifiers: Generate sequential project identifiers
+setting_gravatar_enabled: Use Gravatar user icons
permission_edit_project: Edit project
permission_select_project_modules: Select project modules