FEATURE: support staff only custom user fields

This commit is contained in:
Sam 2015-03-03 17:51:01 +11:00
parent 0ec56ed903
commit 9698447e89
3 changed files with 9 additions and 0 deletions

View File

@ -1078,6 +1078,7 @@ en:
detect_custom_avatars: "Whether or not to check that users have uploaded custom avatars."
max_daily_gravatar_crawls: "Maximum number of times Discourse will check Gravatar for custom avatars in a day"
public_user_custom_fields: "A whitelist of custom fields for a user that can be shown publically."
staff_user_custom_fields: "A whitelist of custom fields for a user that can be shown to staff."
allow_profile_backgrounds: "Allow users to upload profile backgrounds."

View File

@ -299,6 +299,9 @@ users:
public_user_custom_fields:
type: list
default: ''
staff_user_custom_fields:
type: list
default: ''
posting:
min_post_length:

View File

@ -42,6 +42,11 @@ class TopicView
@user_custom_fields = User.custom_fields_for_ids(@posts.map(&:user_id), SiteSetting.public_user_custom_fields.split('|'))
end
if @guardian.is_staff? && SiteSetting.staff_user_custom_fields.present? && @posts
@user_custom_fields ||= {}
@user_custom_fields.deep_merge!(User.custom_fields_for_ids(@posts.map(&:user_id), SiteSetting.staff_user_custom_fields.split('|')))
end
@draft_key = @topic.draft_key
@draft_sequence = DraftSequence.current(@user, @draft_key)
end