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:
Krzysztof Kotlarek
2024-02-19 13:25:59 +11:00
committed by GitHub
parent 1905d434ff
commit fc9648578b
10 changed files with 38 additions and 36 deletions

View File

@ -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,