forked from Gitlink/forgeplus
add: forge platform url and get image action
This commit is contained in:
parent
bfabcf112e
commit
a0223c8b82
|
@ -26,7 +26,7 @@ module ApiIndexHelper
|
|||
{username: user.show_real_name,
|
||||
user_id: user.id,
|
||||
login: user.login,
|
||||
image_url: "/images/#{url_to_avatar(user)}?#{Time.now.to_i}",
|
||||
image_url: "/images/#{forge_user_url_avatar(user)}?#{Time.now.to_i}",
|
||||
admin: user.admin?,
|
||||
user_url: "/users/#{user.try(:login)}"
|
||||
}
|
||||
|
|
|
@ -159,6 +159,10 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def forge_user_url_avatar(source)
|
||||
Rails.application.config_for(:configuration)['forge_platform_url'] + "/api/users/#{source&.login}/get_image" if source.class.to_s == 'User'
|
||||
end
|
||||
|
||||
# 主页banner图
|
||||
def banner_img(source_type)
|
||||
if File.exist?(disk_filename(source_type, "banner"))
|
||||
|
|
|
@ -2,7 +2,7 @@ json.username @user.full_name
|
|||
json.real_name @user.real_name
|
||||
json.login @user.login
|
||||
json.user_id @user.id
|
||||
json.image_url url_to_avatar(@user)
|
||||
json.image_url forge_user_url_avatar(@user)
|
||||
json.admin @user.admin?
|
||||
json.is_teacher @user.user_extension&.teacher?
|
||||
json.user_identity @user.identity
|
||||
|
|
Loading…
Reference in New Issue