Add avatar URL to Discourse Connect
Discourse should download and set the avatar if the user doesn't have one set yet.
This commit is contained in:
parent
512f0ccca1
commit
46b908839d
@ -9,13 +9,5 @@ module AppCatalog
|
||||
@image_url = image_url_for(web_app.apple_touch_icon)
|
||||
end
|
||||
end
|
||||
|
||||
def image_url_for(attachment)
|
||||
if Setting.s3_enabled?
|
||||
s3_image_url(attachment)
|
||||
else
|
||||
Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,6 +8,9 @@ class Discourse::SsoController < ApplicationController
|
||||
sso.email = current_user.email
|
||||
sso.username = current_user.cn
|
||||
sso.name = current_user.display_name
|
||||
if current_user.avatar.attached?
|
||||
sso.avatar_url = helpers.image_url_for(current_user.avatar)
|
||||
end
|
||||
sso.admin = current_user.is_admin?
|
||||
sso.sso_secret = secret
|
||||
|
||||
|
@ -14,4 +14,12 @@ module ApplicationHelper
|
||||
def badge(text, color)
|
||||
tag.span text, class: "inline-flex items-center rounded-full bg-#{color}-100 px-2.5 py-0.5 text-xs font-medium text-#{color}-800"
|
||||
end
|
||||
|
||||
def image_url_for(attachment)
|
||||
if Setting.s3_enabled?
|
||||
s3_image_url(attachment)
|
||||
else
|
||||
Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user