UX: adds chat send shortcut user preference (#30473)

Users can now decide if they want to send a message on:
- <kbd>enter</kbd>
- <kbd>meta + enter</kbd>

If you choose <kbd>meta + enter</kbd>, <kbd>enter</kbd> will add a
linebreak.

<img width="192" alt="Screenshot 2025-01-21 at 12 57 48"
src="https://github.com/user-attachments/assets/abfd6f8b-83b3-4e6f-be67-8f63d536ca8a"
/>
This commit is contained in:
Joffrey JAFFEUX
2025-01-22 13:17:45 +01:00
committed by GitHub
parent a66e5ff728
commit 2cff8c82e3
13 changed files with 195 additions and 10 deletions

View File

@ -61,6 +61,7 @@ after_initialize do
UserUpdater::OPTION_ATTR.push(:chat_email_frequency)
UserUpdater::OPTION_ATTR.push(:chat_header_indicator_preference)
UserUpdater::OPTION_ATTR.push(:chat_separate_sidebar_mode)
UserUpdater::OPTION_ATTR.push(:chat_send_shortcut)
register_reviewable_type Chat::ReviewableMessage
@ -246,6 +247,10 @@ after_initialize do
object.chat_separate_sidebar_mode
end
add_to_serializer(:user_option, :chat_send_shortcut) { object.chat_send_shortcut }
add_to_serializer(:current_user_option, :chat_send_shortcut) { object.chat_send_shortcut }
on(:site_setting_changed) do |name, old_value, new_value|
user_option_field = Chat::RETENTION_SETTINGS_TO_USER_OPTION_FIELDS[name.to_sym]
begin