mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 04:59:22 -06:00
UX: cook message before sending edit (#21303)
This allows for instant feedback in the UI.
This commit is contained in:
parent
7f0682f4f2
commit
0239e88809
@ -591,6 +591,7 @@ export default class ChatLivePane extends Component {
|
||||
}
|
||||
|
||||
#sendEditMessage(message) {
|
||||
message.cook();
|
||||
this.chatChannelPane.sending = true;
|
||||
|
||||
const data = {
|
||||
|
@ -238,6 +238,7 @@ export default class ChatThreadPanel extends Component {
|
||||
}
|
||||
|
||||
#sendEditMessage(message) {
|
||||
message.cook();
|
||||
this.chatChannelThreadPane.sending = true;
|
||||
|
||||
const data = {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user