UX: cook message before sending edit (#21303)

This allows for instant feedback in the UI.
This commit is contained in:
Joffrey JAFFEUX 2023-04-28 20:11:57 +02:00 committed by GitHub
parent 7f0682f4f2
commit 0239e88809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -591,6 +591,7 @@ export default class ChatLivePane extends Component {
}
#sendEditMessage(message) {
message.cook();
this.chatChannelPane.sending = true;
const data = {

View File

@ -238,6 +238,7 @@ export default class ChatThreadPanel extends Component {
}
#sendEditMessage(message) {
message.cook();
this.chatChannelThreadPane.sending = true;
const data = {

View File

@ -138,6 +138,18 @@ RSpec.describe "Chat composer", type: :system, js: true do
expect(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" do
it "cancels editing" do
chat.visit_channel(channel_1)