windy
(Walker Crouse)
2016 年12 月 21 日 17:40
1
I know there are a few other posts about this, but none of them were able to solve my problem. Everything else in our SSO implementation works fine; this is the only thing that’s not working as expected. I’ve tried setting avatar_force_update
to both true
and 1
to no avail.
Code snippet w/ verbose log output: https://gist.github.com/windy1/86ee6965fbcd00036fbeae56cfa659b7
Any insight is much appreciated, thanks.
alehandrof
(Alex Armstrong)
2016 年12 月 21 日 18:23
2
If you’re in development, maybe it’s this:
Edit: nevermind, you’re using non-local URLs.
Falco
(Falco)
2016 年12 月 23 日 16:39
4
DId you enable sso overrides avatar
?
windy
(Walker Crouse)
2016 年12 月 23 日 16:51
5
Yes I did. Sorry should have mentioned that.
windy
(Walker Crouse)
2016 年12 月 27 日 22:16
6
@Falco Any other possible fixes you can think of? Kind of important I work this out.
Falco
(Falco)
2016 年12 月 27 日 22:47
7
In your gist avatar_force_update
isn’t set, did you manage to make it true in verbose logging?
windy
(Walker Crouse)
2016 年12 月 27 日 23:49
8
Yes sorry, I tried both with and without, I had another instance where it was set to true and still no update.
Falco
(Falco)
2016 年12 月 28 日 00:00
9
So even with verbose_logging
showing avatar_force_update = true
the avatar isn’t updated?
Are you runiing against a production docker instance?
windy
(Walker Crouse)
2016 年12 月 28 日 00:14
10
Yeah, I tested on both production and a dev instance on OS X.
EDIT: Just realized I haven’t tested avatar_force_update
on prod, will try that and report back.
windy
(Walker Crouse)
2016 年12 月 28 日 00:47
11
Ok just tested on our production docker instance @Falco and still no update with avatar_force_update: true
in verbose logging.
Falco
(Falco)
2016 年12 月 28 日 01:17
12
The user already exists or is he being created as part of the SSO log in?
Also is /sidekiq
with a queue? Any errors regarding DownloadAvatarFromUrl
?
Also try this in a rails console in a production instance:
user = User.find_by_email(AUSEREMAILHERE)
Jobs.enqueue(:download_avatar_from_url, url: 'http://mycoolavatar.png', user_id: user.id)
and watch logs.
2 个赞
lukegb
(Luke Granger Brown)
2017 年1 月 17 日 01:19
13
For what it’s worth, it works fine. The main problem is that sso_overrides_avatar
is misleadingly named, because it won’t, in fact, override a Gravatar set on a user.
The call to download_avatar_from_url
here:
https://github.com/discourse/discourse/blob/v1.8.0.beta2/app/models/discourse_single_sign_on.rb#L183
doesn’t pass override_gravatar
, so:
https://github.com/discourse/discourse/blob/v1.8.0.beta2/app/jobs/regular/download_avatar_from_url.rb#L15
doesn’t pass on override_gravatar
, so:
https://github.com/discourse/discourse/blob/63a88ee6e7bd9c1cabbea48afd745e20be370275/app/models/user_avatar.rb#L76
won’t set it to the avatar from SSO.
Is this intentional behavior?
5 个赞
zogstrip
(Régis Hanol)
2017 年1 月 17 日 09:38
14
No it’s not. Feel free to do a pull request
4 个赞
lukegb
(Luke Granger Brown)
2017 年1 月 20 日 21:23
16
Thanks! I wasn’t sure if there was an obvious edgecase I’d missed