Re: [openstreetmap/openstreetmap-website] Remove default enabling of gravatar… (#1036)
Tom Hughes
notifications at github.com
Thu Aug 18 19:27:37 UTC 2016
> @@ -799,4 +801,23 @@ def check_signup_allowed(email = nil)
>
> !blocked
> end
> +
> + ##
> + # check if this user has a gravatar and set the user pref is true
> + def gravatar_enable(user)
> + # code from example https://en.gravatar.com/site/implement/images/ruby/
> + return if user.image.present?
> + hash = Digest::MD5.hexdigest(user.email.downcase)
> + url = "https://www.gravatar.com/avatar/#{hash}?d=404" # without d=404 we will always get an image back
> + response = OSM.http_client.get(URI.parse(url))
> + oldsetting = user.image_use_gravatar
> + user.image_use_gravatar = response.success?
> + if oldsetting != user.image_use_gravatar
> + flash[:warning] = if user.image_use_gravatar
I think `:notice` would be more appropriate here - it's an informational message rather than a notification that anything is wrong as such.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1036/files/ad0e7b2c224aa69b9ea5d3c14643745c75a66288#r75373061
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20160818/a38739be/attachment.html>
More information about the rails-dev
mailing list