diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-06-24 11:35:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 11:35:02 +0200 |
commit | 4cb195b2270b92f7dc2393979603fcb72029f09e (patch) | |
tree | e885adfe1244f4bda705395346e8b0ef3ec373f2 | |
parent | a2001262e6c334c6c147effd1cb701cc6edaf4a2 (diff) | |
parent | 0767c88c045fb3c8f492c32664ae5182e1790f14 (diff) |
Merge pull request #5863 from nextcloud/bugfix/noid/only-focus-once
Only scroll to focussed message once
-rw-r--r-- | src/components/MessagesList/MessagesList.vue | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index 65974881a..6aa3c5741 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -459,10 +459,7 @@ export default { }) // get history + new messages - await this.getMessages(true) - } else { - // get only new messages - await this.getMessages(false) + await this.getOldMessages(true) } // focus on next tick to make sure the DOM elements @@ -470,6 +467,9 @@ export default { this.$nextTick(() => { this.scrollToFocussedMessage() }) + + // get new messages + await this.lookForNewMessages() } else { this.$store.dispatch('cancelLookForNewMessages', { requestId: this.chatIdentifier }) } @@ -478,15 +478,8 @@ export default { /** * Fetches the messages of a conversation given the conversation token. Triggers * a long-polling request for new messages. - * @param {boolean} loadOldMessages In case it is the first visit of this conversation, we need to load the history */ - async getMessages(loadOldMessages) { - if (loadOldMessages) { - // Gets the history of the conversation. - await this.getOldMessages(true) - this.scrollToFocussedMessage() - } - + async lookForNewMessages() { // Once the history is received, starts looking for new messages. if (this._isBeingDestroyed || this._isDestroyed) { console.debug('Prevent getting new messages on a destroyed MessagesList') |