From 2db1569fbd51c8a24592a520485e64d60cc42a0f Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 13 Aug 2020 15:47:50 -0700 Subject: [PATCH] Fix conversation last activity calculation --- js/models/conversations.js | 2 +- ts/sql/Server.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index f8db5b6a1..676773c55 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1899,7 +1899,7 @@ const currentTimestamp = this.get('timestamp') || null; const timestamp = activityMessage - ? activityMessage.sent_at || currentTimestamp + ? activityMessage.get('sent_at') || currentTimestamp : currentTimestamp; this.set({ diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index 00fce6399..b49bdd8fa 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -2759,8 +2759,8 @@ async function getLastConversationActivity( const row = await db.get( `SELECT * FROM messages WHERE conversationId = $conversationId AND - type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced') AND - json_extract(json, '$.expirationTimerUpdate.fromSync') != true + (type IS NULL OR type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced')) AND + (json_extract(json, '$.expirationTimerUpdate.fromSync') IS NULL OR json_extract(json, '$.expirationTimerUpdate.fromSync') != 1) ORDER BY received_at DESC LIMIT 1;`, { @@ -2781,7 +2781,7 @@ async function getLastConversationPreview( const row = await db.get( `SELECT * FROM messages WHERE conversationId = $conversationId AND - type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced') + (type IS NULL OR type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced')) ORDER BY received_at DESC LIMIT 1;`, {