diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index 1aaa38ffbda..060ab9a07bd 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -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'), diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb index e643ce7b1e5..9d5c44743da 100644 --- a/app/serializers/current_user_serializer.rb +++ b/app/serializers/current_user_serializer.rb @@ -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