From 923631d9cd0e6e06c9b3cd0a3896c868040a3de0 Mon Sep 17 00:00:00 2001 From: Serubin Date: Sun, 24 May 2020 22:29:18 -0700 Subject: [PATCH 1/2] Add read to session cache --- src/utils/cache_manager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/cache_manager.js b/src/utils/cache_manager.js index 5437c8e0..640a6241 100644 --- a/src/utils/cache_manager.js +++ b/src/utils/cache_manager.js @@ -68,7 +68,7 @@ export default class SessionCache { static putMessages (messages, conversation_id) { let sessionMessages = SessionCache.getAllMessages(); - sessionMessages[conversation_id] = messages; + sessionMessages[conversation_id] = JSON.parse(JSON.stringify(messages)); store.commit('session_messages', sessionMessages); } @@ -225,6 +225,7 @@ export default class SessionCache { if (conversations != null) { for (let i = 0; i < conversations.length; i++) { if (conversations[i].device_id == message.conversation_id) { + conversations[i].read = message.read; conversations[i].timestamp = message.timestamp; conversations[i].snippet = message.mime_type.indexOf("text") > -1 ? message.data : ""; this.putConversations(this.resortConversations(conversations), 'index_public_unarchived'); @@ -237,6 +238,7 @@ export default class SessionCache { if (conversations != null) { for (let i = 0; i < conversations.length; i++) { if (conversations[i].device_id == message.conversation_id) { + conversations[i].read = message.read; conversations[i].timestamp = message.timestamp; conversations[i].snippet = message.mime_type.indexOf("text") > -1 ? message.data : ""; this.putConversations(this.resortConversations(conversations), 'index_archived'); @@ -249,6 +251,7 @@ export default class SessionCache { if (conversations != null) { for (let i = 0; i < conversations.length; i++) { if (conversations[i].device_id == message.conversation_id) { + conversations[i].read = message.read; conversations[i].timestamp = message.timestamp; conversations[i].snippet = message.mime_type.indexOf("text") > -1 ? message.data : ""; this.putConversations(this.resortConversations(conversations), 'index_private'); From 96e298882dfd875fa0e85f3d8bde15125a31a6ac Mon Sep 17 00:00:00 2001 From: Serubin Date: Sun, 24 May 2020 22:32:15 -0700 Subject: [PATCH 2/2] Add updateUnreadCount --- .../Conversations/Conversations.vue | 24 ++++++++----------- src/mixins/unreadCountMixin.js | 11 +++++++++ src/store/state.js | 2 -- 3 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/mixins/unreadCountMixin.js diff --git a/src/components/Conversations/Conversations.vue b/src/components/Conversations/Conversations.vue index 99531a99..410852a0 100644 --- a/src/components/Conversations/Conversations.vue +++ b/src/components/Conversations/Conversations.vue @@ -36,22 +36,22 @@