Re: [openstreetmap-website] Remove default enabling of gravatar… (#1036)

Tom Hughes notifications at github.com
Wed Aug 19 18:01:10 UTC 2015


So by my reckoning that function is about ten times longer than it needs to be... Something like this should be all you need I think:

```ruby
def gravatar_enable(user)
  return if user.image.present?
  hash = Digest::MD5.hexdigest(user.email.downcase)
  url = "https://www.gravatar.com/avatar/#{hash}?d=404"
  response - OSM.http_client.get(URI.parse(url))
  user.image_use_gravatar = response.success?
end
```

Obviously the tests also need to pass...

My only other comment would be, if the current behaviour violates the privacy policy then does this actually fix it? We are still automatically enabling it for anybody that has a gravatar after alll...

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1036#issuecomment-132722622
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20150819/dc8dbfde/attachment.html>


More information about the rails-dev mailing list