[FIX] Removing Edit message from messageBox on room changed (#23910)

pull/23962/head
Yash Rajpal 3 years ago committed by GitHub
parent f8be788549
commit f18d77ca33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/threads/client/flextab/thread.js
  2. 10
      app/ui/client/lib/chatMessages.js

@ -255,7 +255,7 @@ Template.thread.onCreated(async function() {
});
Template.thread.onDestroyed(function() {
const { Threads, threadsObserve, callbackRemove, state } = this;
const { Threads, threadsObserve, callbackRemove, state, chatMessages } = this;
Threads.remove({});
threadsObserve && threadsObserve.stop();
@ -264,6 +264,7 @@ Template.thread.onDestroyed(function() {
const tmid = state.get('tmid');
const rid = state.get('rid');
if (rid && tmid) {
chatMessages.onDestroyed && chatMessages.onDestroyed(rid, tmid);
delete chatMessages[`${ rid }-${ tmid }`];
}
});

@ -592,7 +592,15 @@ export class ChatMessages {
messageBoxState.save({ rid, tmid }, input);
}
onDestroyed(rid) {
onDestroyed(rid, tmid) {
UserAction.cancel(rid);
if (this.input.parentElement.classList.contains('editing') === true) {
if (!tmid) {
this.clearCurrentDraft();
this.clearEditing();
}
messageBoxState.set(this.input, '');
messageBoxState.save({ rid, tmid }, this.$input);
}
}
}

Loading…
Cancel
Save