diff --git a/app/components/app_catalog/web_app_icon_component.rb b/app/components/app_catalog/web_app_icon_component.rb index 8421d4f..0ce082e 100644 --- a/app/components/app_catalog/web_app_icon_component.rb +++ b/app/components/app_catalog/web_app_icon_component.rb @@ -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 diff --git a/app/controllers/discourse/sso_controller.rb b/app/controllers/discourse/sso_controller.rb index 658f434..ca47e68 100644 --- a/app/controllers/discourse/sso_controller.rb +++ b/app/controllers/discourse/sso_controller.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 50959f6..a43b13e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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