mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
compose: Don't allow same message to be sent twice.
It is possible to send the message twice by clicking send button very quickly twice or by pressing enter and send button simultaneously. This can be easily reproduced for large messages sent in a stream narrow. Hard to reproduce for small messages or in PM narrows. I was not able to reproduce locally, but was able to reproduce on chat.zulip.org. So, this is an untested bug fix. Fixes #22562
This commit is contained in:
@@ -290,7 +290,17 @@ export function enter_with_preview_open(ctrl_pressed = false) {
|
||||
}
|
||||
}
|
||||
|
||||
// Common entrypoint for asking the server to send the message
|
||||
// currently drafted in the compose box, including for scheduled
|
||||
// messages.
|
||||
export function finish() {
|
||||
if (compose_ui.compose_spinner_visible) {
|
||||
// Avoid sending a message twice in parallel in races where
|
||||
// the user clicks the `Send` button very quickly twice or
|
||||
// presses enter and the send button simultaneously.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
clear_preview_area();
|
||||
clear_invites();
|
||||
clear_private_stream_alert();
|
||||
|
||||
Reference in New Issue
Block a user