diff options
author | Vincent Petry <vincent@nextcloud.com> | 2021-03-18 14:22:50 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2021-03-18 14:22:50 +0300 |
commit | b9e8b6549f452667db4c00aff89056e9afdb72b8 (patch) | |
tree | cd6436d22d8d4d9494b7f4ef9b28f16b267dc056 /src/components/NewMessageForm | |
parent | e1d0f894f8f115e8ac63b5eeffc6d88c2c1eeb27 (diff) |
Keep pending input message per conversation
Save the message from the current input field by conversation into the
store.
This makes it possible to keep the message when switching the
conversation.
Also fixes an issue where joining or leaving a call would clear the
message due to the field being destroyed and recreated between the
message list and the sidebar.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src/components/NewMessageForm')
-rw-r--r-- | src/components/NewMessageForm/NewMessageForm.vue | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/components/NewMessageForm/NewMessageForm.vue b/src/components/NewMessageForm/NewMessageForm.vue index c16c5a101..faeb145a5 100644 --- a/src/components/NewMessageForm/NewMessageForm.vue +++ b/src/components/NewMessageForm/NewMessageForm.vue @@ -230,11 +230,24 @@ export default { disabled(newValue) { this.$refs.uploadMenu.$refs.menuButton.disabled = newValue }, + + text(newValue) { + this.$store.dispatch('setCurrentMessageInput', { token: this.token, text: newValue }) + }, + + token(token) { + if (token) { + this.text = this.$store.getters.currentMessageInput(token) || '' + } else { + this.text = '' + } + }, }, mounted() { EventBus.$on('uploadStart', this.handleUploadStart) EventBus.$on('retryMessage', this.handleRetryMessage) + this.text = this.$store.getters.currentMessageInput(this.token) || '' }, beforeDestroy() { |