mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: avoid checking card background and user background when not supplied (#11299)
Previously we were performing a bunch of needless work when SSO failed to supply profile and card backgrounds.
This commit is contained in:
parent
51f9a56137
commit
3e1b94c227
@ -305,8 +305,10 @@ class DiscourseSingleSignOn < SingleSignOn
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if profile_background_url.present?
|
||||||
profile_background_missing = user.user_profile.profile_background_upload.blank? || Upload.get_from_url(user.user_profile.profile_background_upload.url).blank?
|
profile_background_missing = user.user_profile.profile_background_upload.blank? || Upload.get_from_url(user.user_profile.profile_background_upload.url).blank?
|
||||||
if (profile_background_missing || SiteSetting.sso_overrides_profile_background) && profile_background_url.present?
|
|
||||||
|
if profile_background_missing || SiteSetting.sso_overrides_profile_background
|
||||||
profile_background_changed = sso_record.external_profile_background_url != profile_background_url
|
profile_background_changed = sso_record.external_profile_background_url != profile_background_url
|
||||||
if profile_background_changed || profile_background_missing
|
if profile_background_changed || profile_background_missing
|
||||||
Jobs.enqueue(:download_profile_background_from_url,
|
Jobs.enqueue(:download_profile_background_from_url,
|
||||||
@ -316,9 +318,11 @@ class DiscourseSingleSignOn < SingleSignOn
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if card_background_url.present?
|
||||||
card_background_missing = user.user_profile.card_background_upload.blank? || Upload.get_from_url(user.user_profile.card_background_upload.url).blank?
|
card_background_missing = user.user_profile.card_background_upload.blank? || Upload.get_from_url(user.user_profile.card_background_upload.url).blank?
|
||||||
if (card_background_missing || SiteSetting.sso_overrides_profile_background) && card_background_url.present?
|
if card_background_missing || SiteSetting.sso_overrides_profile_background
|
||||||
card_background_changed = sso_record.external_card_background_url != card_background_url
|
card_background_changed = sso_record.external_card_background_url != card_background_url
|
||||||
if card_background_changed || card_background_missing
|
if card_background_changed || card_background_missing
|
||||||
Jobs.enqueue(:download_profile_background_from_url,
|
Jobs.enqueue(:download_profile_background_from_url,
|
||||||
@ -328,6 +332,7 @@ class DiscourseSingleSignOn < SingleSignOn
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# change external attributes for sso record
|
# change external attributes for sso record
|
||||||
sso_record.external_username = username
|
sso_record.external_username = username
|
||||||
|
Loading…
Reference in New Issue
Block a user