Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-03-18 12:49:46 +0300
committerVincent Petry <vincent@nextcloud.com>2021-03-18 12:49:46 +0300
commit7b6d1065d0f2c6d6b8bb46acfe5100856a2e0cfd (patch)
treeb18bc39bf054920f2914d57b499ae5b2dd5e030b /src/store/messagesStore.js
parente1d0f894f8f115e8ac63b5eeffc6d88c2c1eeb27 (diff)
Re-fetch conversation after marking as read
Re-fetching makes sure that harder to compute values are re-fetched from the server like unreadMessages, unreadMention, etc. This introduces a new store action "fetchConversation". Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src/store/messagesStore.js')
-rw-r--r--src/store/messagesStore.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js
index 6d8564de8..e618e4795 100644
--- a/src/store/messagesStore.js
+++ b/src/store/messagesStore.js
@@ -386,7 +386,7 @@ const actions = {
* @param {bool} updateVisually whether to also update the marker visually in the UI;
*/
async updateLastReadMessage(context, { token, id = 0, updateVisually = false }) {
- const conversation = Object.assign({}, context.getters.conversations[token])
+ const conversation = context.getters.conversations[token]
if (!conversation || conversation.lastReadMessage === id) {
return
}
@@ -400,7 +400,13 @@ const actions = {
if (updateVisually) {
context.commit('setVisualLastReadMessageId', { token, id })
}
+
await updateLastReadMessage(token, id)
+
+ if (updateVisually) {
+ // refetch to get more accurate values for unreadMessages, unreadMention, etc
+ context.dispatch('fetchConversation', { token })
+ }
},
}