Left pane preview/timestamp: Further refine logic

This commit is contained in:
Scott Nonnenberg 2020-08-27 11:36:11 -07:00 committed by Josh Perez
parent bcd4f6407f
commit 8d5e832ed6
2 changed files with 9 additions and 9 deletions

View file

@ -1884,11 +1884,6 @@
}), }),
]); ]);
// This is the less-restrictive of these two fetches; if it's falsey, both will be
if (!previewMessage) {
return;
}
if ( if (
this.hasDraft() && this.hasDraft() &&
this.get('draftTimestamp') && this.get('draftTimestamp') &&
@ -1903,10 +1898,15 @@
: currentTimestamp; : currentTimestamp;
this.set({ this.set({
lastMessage: previewMessage.getNotificationText() || '', lastMessage:
lastMessageStatus: previewMessage.getMessagePropStatus() || null, (previewMessage ? previewMessage.getNotificationText() : '') || '',
lastMessageStatus:
(previewMessage ? previewMessage.getMessagePropStatus() : null) ||
null,
timestamp, timestamp,
lastMessageDeletedForEveryone: previewMessage.deletedForEveryone, lastMessageDeletedForEveryone: previewMessage
? previewMessage.deletedForEveryone
: false,
}); });
window.Signal.Data.updateConversation(this.attributes); window.Signal.Data.updateConversation(this.attributes);

View file

@ -2759,7 +2759,7 @@ async function getLastConversationActivity(
const row = await db.get( const row = await db.get(
`SELECT * FROM messages WHERE `SELECT * FROM messages WHERE
conversationId = $conversationId AND conversationId = $conversationId AND
(type IS NULL OR type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced')) AND (type IS NULL OR type NOT IN ('profile-change', 'verified-change', 'message-history-unsynced', 'keychange')) AND
(json_extract(json, '$.expirationTimerUpdate.fromSync') IS NULL OR json_extract(json, '$.expirationTimerUpdate.fromSync') != 1) (json_extract(json, '$.expirationTimerUpdate.fromSync') IS NULL OR json_extract(json, '$.expirationTimerUpdate.fromSync') != 1)
ORDER BY received_at DESC ORDER BY received_at DESC
LIMIT 1;`, LIMIT 1;`,