0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/chat/spec/models/user_option_spec.rb
Keegan George 436041645f
FEATURE: Make the message send shortcut a core user option (#42105)
**Previously**, the enter/meta+enter send shortcut was a chat-only
preference (`chat_send_shortcut`), so chat-style composers in other
plugins — like AI bot conversations — always sent on Enter with no way
to insert a newline.

**In this update**, promoted it to a core `send_shortcut` user option on
the Interface preferences page, honored by the chat composer, the core
docked composer, and AI bot conversations.

The `chat_send_shortcut` column is backfilled into `send_shortcut`
post-deploy and kept (ignored) for now, mirroring the
`push_notification_level` promotion; the column drop, the serializer
compatibility alias removal, and the `plugin_manifest.yml` cleanup land
in a follow-up PR.

| Before | After |
| --- | --- |
|
![before](https://github.com/discourse/discourse/releases/download/_gh-attach-assets/before-jmgi09.png)
|
![after](https://github.com/discourse/discourse/releases/download/_gh-attach-assets/after-crkznx.png)
|
2026-07-28 13:58:12 -07:00

39 lines
1.1 KiB
Ruby
Vendored

# frozen_string_literal: true
RSpec.describe UserOption do
describe "#chat_separate_sidebar_mode" do
it "is present" do
expect(described_class.new.chat_separate_sidebar_mode).to eq("default")
end
end
describe "#show_thread_title_prompts" do
it "is present" do
expect(described_class.new.show_thread_title_prompts).to eq(true)
end
end
describe "#chat_announce_new_messages" do
it "defaults to true" do
expect(described_class.new.chat_announce_new_messages).to eq(true)
end
end
describe "#chat_new_message_sound" do
it "defaults to false" do
expect(described_class.new.chat_new_message_sound).to eq(false)
end
end
describe "#chat_quick_reaction_type" do
it "is present with frequent as default" do
expect(described_class.new.chat_quick_reaction_type).to eq("frequent")
end
end
describe "#chat_send_shortcut" do
fab!(:user)
it "persists legacy updater assignments to send_shortcut" do
expect(UserUpdater.new(user, user).update(chat_send_shortcut: "meta_enter")).to eq(true)
expect(user.user_option.reload.send_shortcut).to eq("meta_enter")
end
end
end