From ba20a678737c0ca84382826f1a7bd22cc40fe4eb 2008-10-31 00:41:28
From: Eric Davis
Date: 2008-10-31 00:41:28
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
---
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 556b955..b944a4a 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 64fb8bf..305629a 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? %>
-
diff --git a/config/settings.yml b/config/settings.yml
index 7d6a9d1..02f0b13 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 01b1d1c..42c4e96 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