A platform for community discussion. Free, open, simple.
UX: cook message before sending edit (#21303)
Joffrey JAFFEUX0239e88809c9
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel.jsindex 521ca5c12e8..3e081287531 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js@@ -591,6 +591,7 @@ export default class ChatLivePane extends Component {}#sendEditMessage(message) {+ message.cook();this.chatChannelPane.sending = true;const data = {diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js b/plugins/chat/assets/javascripts/discourse/components/chat-thread.jsindex 7eb9fc2851f..ab7f5c5c4e6 100644--- a/plugins/chat/assets/javascripts/discourse/components/chat-thread.js+++ b/plugins/chat/assets/javascripts/discourse/components/chat-thread.js@@ -238,6 +238,7 @@ export default class ChatThreadPanel extends Component {}#sendEditMessage(message) {+ message.cook();this.chatChannelThreadPane.sending = true;const data = {diff --git a/plugins/chat/spec/system/chat_composer_spec.rb b/plugins/chat/spec/system/chat_composer_spec.rbindex 472346a060a..0c5806749b5 100644--- a/plugins/chat/spec/system/chat_composer_spec.rb+++ b/plugins/chat/spec/system/chat_composer_spec.rb@@ -138,6 +138,18 @@ RSpec.describe "Chat composer", type: :system, js: true doexpect(find(".chat-composer__input").value).to eq(message_2.message)end+ it "updates the message instantly" do+ chat.visit_channel(channel_1)+ page.driver.browser.network_conditions = { offline: true }++ channel.edit_message(message_2)+ find(".chat-composer__input").send_keys("instant")+ channel.click_send_message++ expect(channel).to have_message(text: message_2.message + "instant")+ page.driver.browser.network_conditions = { offline: false }+ end+context "when pressing escape" doit "cancels editing" dochat.visit_channel(channel_1)