diff --git a/js/models/conversations.js b/js/models/conversations.js index ed7fc66d102..5a0feec1d4f 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1157,7 +1157,6 @@ ? lastMessageModel.getMessagePropStatus() : null; const lastMessageUpdate = Conversation.createLastMessageUpdate({ - currentLastMessageText: this.get('lastMessage') || null, currentTimestamp: this.get('timestamp') || null, lastMessage: lastMessageJSON, lastMessageStatus: lastMessageStatusModel, diff --git a/ts/test/types/Conversation_test.ts b/ts/test/types/Conversation_test.ts index 85f1c77d0ec..a220f52bb6e 100644 --- a/ts/test/types/Conversation_test.ts +++ b/ts/test/types/Conversation_test.ts @@ -24,7 +24,6 @@ describe('Conversation', () => { context('for regular message', () => { it('should update last message text and timestamp', () => { const input = { - currentLastMessageText: 'Existing message', currentTimestamp: 555, lastMessageStatus: 'read', lastMessage: { @@ -48,7 +47,6 @@ describe('Conversation', () => { context('for verified change message', () => { it('should skip update', () => { const input = { - currentLastMessageText: 'bingo', currentTimestamp: 555, lastMessage: { type: 'verified-change', @@ -59,7 +57,7 @@ describe('Conversation', () => { lastMessageNotificationText: 'Verified Changed', }; const expected = { - lastMessage: 'bingo', + lastMessage: '', lastMessageStatus: null, timestamp: 555, }; @@ -72,7 +70,6 @@ describe('Conversation', () => { context('for expire timer update from sync', () => { it('should update message but not timestamp (to prevent bump to top)', () => { const input = { - currentLastMessageText: 'I am expired', currentTimestamp: 555, lastMessage: { type: 'incoming', diff --git a/ts/types/Conversation.ts b/ts/types/Conversation.ts index cde17a1d454..943e4caec82 100644 --- a/ts/types/Conversation.ts +++ b/ts/types/Conversation.ts @@ -7,13 +7,11 @@ interface ConversationLastMessageUpdate { } export const createLastMessageUpdate = ({ - currentLastMessageText, currentTimestamp, lastMessage, lastMessageStatus, lastMessageNotificationText, }: { - currentLastMessageText?: string; currentTimestamp?: number; lastMessage?: Message; lastMessageStatus?: string; @@ -32,10 +30,10 @@ export const createLastMessageUpdate = ({ const isExpireTimerUpdateFromSync = Boolean( expirationTimerUpdate && expirationTimerUpdate.fromSync ); + const shouldUpdateTimestamp = Boolean( !isVerifiedChangeMessage && !isExpireTimerUpdateFromSync ); - const newTimestamp = shouldUpdateTimestamp ? lastMessage.sent_at : currentTimestamp; @@ -43,7 +41,7 @@ export const createLastMessageUpdate = ({ const shouldUpdateLastMessageText = !isVerifiedChangeMessage; const newLastMessageText = shouldUpdateLastMessageText ? lastMessageNotificationText - : currentLastMessageText; + : ''; return { lastMessage: newLastMessageText || '',