Commit 3295a4db9dc417f368720f7fe9724ec8bee0ddcd

Authored by Dmitriy Zaporozhets
2 parents 972e40cc ca192608

Merge branch 'email_in_gravatar_urls' into 'master'

allow passing user's email address in custom Gravatar urls

Some custom avatar systems use the user's email address rather than its hash. This merge request will allow the administrator to configure gitlab-ce to use the user's email address gravatar.plain_url and  gravatar.ssl_url in the config file like this:

```
gravatar:
    enabled: true
    plain_url: "http://company.com/avatar/?mail=%{email}&size=%{size}"
    ssl_url: "https://company.com/avatar/?mail=%{email}&size=%{size}"
```

It's a only a 2 word patch.
app/helpers/application_helper.rb
... ... @@ -75,7 +75,7 @@ module ApplicationHelper
75 75 else
76 76 gravatar_url = request.ssl? || gitlab_config.https ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url
77 77 user_email.strip!
78   - sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size
  78 + sprintf gravatar_url, hash: Digest::MD5.hexdigest(user_email.downcase), size: size, email: user_email
79 79 end
80 80 end
81 81  
... ...
config/gitlab.yml.example
... ... @@ -117,6 +117,7 @@ production: &base
117 117 ## Gravatar
118 118 gravatar:
119 119 enabled: true # Use user avatar image from Gravatar.com (default: true)
  120 + # gravatar urls: possible placeholders: %{hash} %{size} %{email}
120 121 # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
121 122 # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=mm
122 123  
... ...