mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 09:11:17 +08:00
DEV: Make more group-based settings client: false (#25735)
Affects the following settings: delete_all_posts_and_topics_allowed_groups experimental_new_new_view_groups enable_experimental_admin_ui_groups custom_summarization_allowed_groups pm_tags_allowed_for_groups chat_allowed_groups direct_message_enabled_groups chat_message_flag_allowed_groups This turns off client: true for these group-based settings, because there is no guarantee that the current user gets all their group memberships serialized to the client. Better to check server-side first.
This commit is contained in:

committed by
GitHub

parent
1905d434ff
commit
fc9648578b
@ -143,6 +143,15 @@ after_initialize do
|
||||
end,
|
||||
) { true }
|
||||
|
||||
add_to_serializer(
|
||||
:current_user,
|
||||
:can_direct_message,
|
||||
include_condition: -> do
|
||||
return @can_direct_message if defined?(@can_direct_message)
|
||||
@can_direct_message = SiteSetting.chat_enabled && scope.can_direct_message?
|
||||
end,
|
||||
) { true }
|
||||
|
||||
add_to_serializer(
|
||||
:current_user,
|
||||
:has_chat_enabled,
|
||||
|
Reference in New Issue
Block a user