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." 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" 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." 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." allow_profile_backgrounds: "Allow users to upload profile backgrounds."

View File

@ -299,6 +299,9 @@ users:
public_user_custom_fields: public_user_custom_fields:
type: list type: list
default: '' default: ''
staff_user_custom_fields:
type: list
default: ''
posting: posting:
min_post_length: 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('|')) @user_custom_fields = User.custom_fields_for_ids(@posts.map(&:user_id), SiteSetting.public_user_custom_fields.split('|'))
end 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_key = @topic.draft_key
@draft_sequence = DraftSequence.current(@user, @draft_key) @draft_sequence = DraftSequence.current(@user, @draft_key)
end end