Return the current user's custom fields
This commit is contained in:
parent
f085770ed4
commit
651def63e5
|
@ -455,6 +455,7 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
username: currentUser.get('username'),
|
||||
user_id: currentUser.get('id'),
|
||||
uploaded_avatar_id: currentUser.get('uploaded_avatar_id'),
|
||||
user_custom_fields: currentUser.get('custom_fields'),
|
||||
archetype: this.get('archetypeId'),
|
||||
post_type: Discourse.Site.currentProp('post_types.regular'),
|
||||
target_usernames: this.get('targetUsernames'),
|
||||
|
|
|
@ -20,7 +20,8 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:can_delete_account,
|
||||
:should_be_redirected_to_top,
|
||||
:redirected_to_top_reason,
|
||||
:disable_jump_reply
|
||||
:disable_jump_reply,
|
||||
:custom_fields
|
||||
|
||||
def include_site_flagged_posts_count?
|
||||
object.staff?
|
||||
|
@ -70,4 +71,10 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
object.redirected_to_top_reason.present?
|
||||
end
|
||||
|
||||
def custom_fields
|
||||
return {} unless SiteSetting.public_user_custom_fields.present?
|
||||
fields = User.custom_fields_for_ids([object.id], SiteSetting.public_user_custom_fields.split('|'))
|
||||
return fields.present? ? fields[object.id] : {}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue