mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -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) {
|
#sendEditMessage(message) {
|
||||||
|
message.cook();
|
||||||
this.chatChannelPane.sending = true;
|
this.chatChannelPane.sending = true;
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -238,6 +238,7 @@ export default class ChatThreadPanel extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#sendEditMessage(message) {
|
#sendEditMessage(message) {
|
||||||
|
message.cook();
|
||||||
this.chatChannelThreadPane.sending = true;
|
this.chatChannelThreadPane.sending = true;
|
||||||
|
|
||||||
const data = {
|
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)
|
expect(find(".chat-composer__input").value).to eq(message_2.message)
|
||||||
end
|
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
|
context "when pressing escape" do
|
||||||
it "cancels editing" do
|
it "cancels editing" do
|
||||||
chat.visit_channel(channel_1)
|
chat.visit_channel(channel_1)
|
||||||
|
Loading…
Reference in New Issue
Block a user