From 4fa9e33bd593d06edab619350e3986127511b2df Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Thu, 12 Aug 2021 20:51:10 +0300 Subject: [PATCH] Cancel reply on message delete Draft: fix setting reply if message is empty --- src/components/chat/input.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/chat/input.ts b/src/components/chat/input.ts index 55205487..87f985f8 100644 --- a/src/components/chat/input.ts +++ b/src/components/chat/input.ts @@ -494,8 +494,14 @@ export default class ChatInput { }); } else { this.listenerSetter.add(rootScope)('history_delete', ({peerId, msgs}) => { - if(this.chat.peerId === peerId && msgs[this.editMsgId]) { - this.onMessageSent(); + if(this.chat.peerId === peerId) { + if(msgs[this.editMsgId]) { + this.onMessageSent(); + } + + if(this.replyToMsgId && msgs[this.replyToMsgId]) { + this.clearHelper('reply'); + } } }); } @@ -725,7 +731,7 @@ export default class ChatInput { } } - if(this.messageInputField.value === draft.rMessage) return false; + if(this.messageInputField.value === draft.rMessage && this.replyToMsgId === draft.reply_to_msg_id) return false; this.clearHelper(); this.noWebPage = draft.pFlags.no_webpage;