Skip to content

A platform for community discussion. Free, open, simple.

FIX: correctly resets editing state when done (#23209)

Joffrey JAFFEUXfc93604b9e6e
diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
index 8aeb71f6f87..255b2b6b5d3 100644
--- a/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
+++ b/plugins/chat/assets/javascripts/discourse/components/chat-channel.js
@@ -539,6 +539,7 @@ export default class ChatChannel extends Component {
} catch (e) {
popupAjaxError(e);
} finally {
+ message.editing = false;
this.chatDraftsManager.remove({ channelId: this.args.channel.id });
this.pane.sending = false;
}
diff --git a/plugins/chat/spec/system/edited_message_spec.rb b/plugins/chat/spec/system/edited_message_spec.rb
index 4e9f51a3d13..5a4302f6584 100644
--- a/plugins/chat/spec/system/edited_message_spec.rb
+++ b/plugins/chat/spec/system/edited_message_spec.rb
@@ -44,4 +44,16 @@ RSpec.describe "Edited message", type: :system do
expect(page).to have_css(".cooked-date")
end
end
+
+ context "when replying to and edited message" do
+ fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1, user: current_user) }
+
+ it "shows the correct reply indicator" do
+ chat_page.visit_channel(channel_1)
+ channel_page.edit_message(message_1, message_1.message + "a")
+ channel_page.reply_to(message_1)
+
+ expect(channel_page.composer.message_details).to be_replying_to(message_1)
+ end
+ end
end