Project

General

Profile

Actions

Feature #6481

open

Gravatars: Add option to force default avatar display

Added by Sebastian M. over 13 years ago. Updated about 13 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
UI
Target version:
-
Start date:
2010-09-24
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

We would like to see an admin option to force the display of the default gravatar icon.

This can be implemented very easily be adding the following parameter to the gravatar url: &forcedefault=1

Now If I choose for example wavatar as the default gravatar icon in the display options, and then check this new "force" option, the above url parameter will be appended to the url, resulting in the display of the wavatar wven if the user uploaded a picture in gravatar.

This way offensive/annoying custom gravatars can be avioded.

Actions #1

Updated by Felix Schäfer over 13 years ago

  • Assignee set to Felix Schäfer

I'll try to have a look at this tonight, the patch probably won't make it to 1.0.2 though.

Actions #2

Updated by Felix Schäfer over 13 years ago

I couldn't find any mention of that in the API docs, and we won't support unofficial APIs where we can avoid it.

Actions #3

Updated by Eric Davis over 13 years ago

If it's in the official Gravatar API we can use it. Redmine is using my fork of the Gravatar plugin already so we can add features to it that we need.

Actions #4

Updated by Felix Schäfer over 13 years ago

Eric Davis wrote:

If it's in the official Gravatar API we can use it.

As I said, can't find it mentioned here http://en.gravatar.com/site/implement/images/

Redmine is using my fork of the Gravatar plugin already so we can add features to it that we need.

I know :-)

Actions #5

Updated by Sebastian M. over 13 years ago

I asked the gravatar devs to add it to the official api.

Meanwhile, could you tell me wich line I have to edit to add that parameter in the sourcecode?

Actions #6

Updated by Felix Schäfer over 13 years ago

Sebastian M. wrote:

I asked the gravatar devs to add it to the official api.

Please update this ticket once they have, I'll take care of adding the feature.

Meanwhile, could you tell me wich line I have to edit to add that parameter in the sourcecode?

Here's a diff that should (i.e. non-tested) work:

diff --git a/vendor/plugins/gravatar/lib/gravatar.rb b/vendor/plugins/gravatar/lib/gravatar.rb
index 9af1fed..43e2c9e 100644
--- a/vendor/plugins/gravatar/lib/gravatar.rb
+++ b/vendor/plugins/gravatar/lib/gravatar.rb
@@ -35,6 +35,9 @@ module GravatarHelper

     # Whether or not to display the gravatars using HTTPS instead of HTTP
     :ssl => false,
+    
+    # Whether or not to display user's custom gravatars or only the generated ones
+    :forcedefault => 1,
   }

   # The methods that will be made available to your views.
@@ -73,7 +76,7 @@ module GravatarHelper
       options[:default] = CGI::escape(options[:default]) unless options[:default].nil?
       returning gravatar_api_url(email_hash, options.delete(:ssl)) do |url|
         opts = []
-        [:rating, :size, :default].each do |opt|
+        [:rating, :size, :default, :forcedefault].each do |opt|
           unless options[opt].nil?
             value = h(options[opt])
             opts << [opt, value].join('=')
Actions #7

Updated by Sebastian M. over 13 years ago

Hello Felix, just got an email from the devs that dey added it to the API: http://en.gravatar.com/site/implement/images/

Best regards,

Sebastian

Actions #8

Updated by Sebastian M. over 13 years ago

Any chance to get this into the next version?

Actions #9

Updated by Felix Schäfer over 13 years ago

I have a working patch stashed in my local git repo, I wasn't able to make the spec run correctly though…

Eric Hulser: do you have the time to take care of running the spec for the gravatar plugin, I'd commit my changes to github in the evening (CEST) then.

Actions #10

Updated by Felix Schäfer over 13 years ago

  • Assignee deleted (Felix Schäfer)
Actions #11

Updated by Sebastian M. about 13 years ago

Hmm does this mean nobody takes care of this ticket now? I successfully integrated Felix's patch, it works, so it should not be so difficult to integrate it into the admin options, shouldn't it? I am not a ruby coder, so unfortunately I can't do it myself. :/

Actions

Also available in: Atom PDF