diff --git a/ts/data/data.ts b/ts/data/data.ts index e554717e1..900920b6a 100644 --- a/ts/data/data.ts +++ b/ts/data/data.ts @@ -144,7 +144,7 @@ export const Data = { getMessageById, getMessageByServerId, filterAlreadyFetchedOpengroupMessage, - getMessageBySenderAndTimestamp, + getMessageBySenderAndSentAt, getUnreadByConversation, getUnreadCountByConversation, markAllAsReadByConversationNoExpiration, @@ -454,14 +454,14 @@ async function filterAlreadyFetchedOpengroupMessage( * @param source senders id * @param timestamp the timestamp of the message - not to be confused with the serverTimestamp. This is equivalent to sent_at */ -async function getMessageBySenderAndTimestamp({ +async function getMessageBySenderAndSentAt({ source, timestamp, }: { source: string; timestamp: number; }): Promise { - const messages = await channels.getMessageBySenderAndTimestamp({ + const messages = await channels.getMessageBySenderAndSentAt({ source, timestamp, }); diff --git a/ts/data/dataInit.ts b/ts/data/dataInit.ts index e0f7eb794..09c402f30 100644 --- a/ts/data/dataInit.ts +++ b/ts/data/dataInit.ts @@ -46,7 +46,7 @@ const channelsToMake = new Set([ 'removeAllMessagesInConversation', 'getMessageCount', 'filterAlreadyFetchedOpengroupMessage', - 'getMessageBySenderAndTimestamp', + 'getMessageBySenderAndSentAt', 'getMessageIdsFromServerIds', 'getMessageById', 'getMessagesBySentAt', diff --git a/ts/node/sql.ts b/ts/node/sql.ts index f79f43db6..41a2a8c2d 100644 --- a/ts/node/sql.ts +++ b/ts/node/sql.ts @@ -1062,13 +1062,7 @@ function getMessagesCountBySender({ source }: { source: string }) { return count['count(*)'] || 0; } -function getMessageBySenderAndTimestamp({ - source, - timestamp, -}: { - source: string; - timestamp: number; -}) { +function getMessageBySenderAndSentAt({ source, timestamp }: { source: string; timestamp: number }) { const rows = assertGlobalInstance() .prepare( `SELECT json FROM ${MESSAGES_TABLE} WHERE @@ -2460,7 +2454,7 @@ export const sqlNode = { getMessageCountByType, filterAlreadyFetchedOpengroupMessage, - getMessageBySenderAndTimestamp, + getMessageBySenderAndSentAt, getMessageIdsFromServerIds, getMessageById, getMessagesBySentAt, diff --git a/ts/receiver/contentMessage.ts b/ts/receiver/contentMessage.ts index aa8dc813a..2235933e8 100644 --- a/ts/receiver/contentMessage.ts +++ b/ts/receiver/contentMessage.ts @@ -565,7 +565,7 @@ async function handleUnsendMessage(envelope: EnvelopePlus, unsendMessage: Signal return; } - const messageToDelete = await Data.getMessageBySenderAndTimestamp({ + const messageToDelete = await Data.getMessageBySenderAndSentAt({ source: messageAuthor, timestamp: toNumber(timestamp), }); diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index fb9a95b50..853889a26 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -258,7 +258,7 @@ export async function isSwarmMessageDuplicate({ sentAt: number; }) { try { - const result = await Data.getMessageBySenderAndTimestamp({ + const result = await Data.getMessageBySenderAndSentAt({ source, timestamp: sentAt, }); diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index e8083836e..431c62f34 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -394,7 +394,7 @@ async function getMessages({ if (!results.length) { const dbResult = ( - await Data.getMessageBySenderAndTimestamp({ source: sender, timestamp }) + await Data.getMessageBySenderAndSentAt({ source: sender, timestamp }) )?.getMessageModelProps(); if (dbResult) { results = [dbResult];