FIX: sso_overrides_avatar should override previously set avatar

This commit is contained in:
Arpit Jalan 2017-01-19 10:52:24 +05:30
parent 07660ecedb
commit 0791c2c966

View File

@ -146,7 +146,7 @@ class DiscourseSingleSignOn < SingleSignOn
sso_record.last_payload = unsigned_payload sso_record.last_payload = unsigned_payload
sso_record.external_id = external_id sso_record.external_id = external_id
else else
Jobs.enqueue(:download_avatar_from_url, url: avatar_url, user_id: user.id) if avatar_url.present? Jobs.enqueue(:download_avatar_from_url, url: avatar_url, user_id: user.id, override_gravatar: SiteSetting.sso_overrides_avatar) if avatar_url.present?
user.create_single_sign_on_record( user.create_single_sign_on_record(
last_payload: unsigned_payload, last_payload: unsigned_payload,
external_id: external_id, external_id: external_id,
@ -180,7 +180,7 @@ class DiscourseSingleSignOn < SingleSignOn
avatar_changed = sso_record.external_avatar_url != avatar_url avatar_changed = sso_record.external_avatar_url != avatar_url
if avatar_force_update || avatar_changed || avatar_missing if avatar_force_update || avatar_changed || avatar_missing
Jobs.enqueue(:download_avatar_from_url, url: avatar_url, user_id: user.id) Jobs.enqueue(:download_avatar_from_url, url: avatar_url, user_id: user.id, override_gravatar: SiteSetting.sso_overrides_avatar)
end end
end end