download steam avatar

This commit is contained in:
Mike Rosack 2016-11-19 09:28:47 -06:00
parent 491a3682a2
commit 50fd2ef5d8
1 changed files with 10 additions and 0 deletions

View File

@ -30,9 +30,19 @@ class SteamAuthenticator < ::Auth::Authenticator
result.name = data["name"] # unless profile privacy set to private
result.extra_data = { steam_uid: steam_uid }
retrieve_avatar(result.user, data["image"])
result
end
def retrieve_avatar(user, image_url)
return unless user
return unless image_url
return if user.user_avatar.try(:custom_upload_id).present?
Jobs.enqueue(:download_avatar_from_url, url: image_url, user_id: user.id, override_gravatar: true)
end
def after_create_account(user, auth)
data = auth[:extra_data]
::PluginStore.set('steam', "steam_uid_#{data[:steam_uid]}", {user_id: user.id })