mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
refactor: rename getMessageBySenderAndTimestamp to getMessageBySenderAndSentAt
its more clear what parameters are needed
This commit is contained in:
parent
d706ecdead
commit
1ff2969750
|
@ -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<MessageModel | null> {
|
||||
const messages = await channels.getMessageBySenderAndTimestamp({
|
||||
const messages = await channels.getMessageBySenderAndSentAt({
|
||||
source,
|
||||
timestamp,
|
||||
});
|
||||
|
|
|
@ -46,7 +46,7 @@ const channelsToMake = new Set([
|
|||
'removeAllMessagesInConversation',
|
||||
'getMessageCount',
|
||||
'filterAlreadyFetchedOpengroupMessage',
|
||||
'getMessageBySenderAndTimestamp',
|
||||
'getMessageBySenderAndSentAt',
|
||||
'getMessageIdsFromServerIds',
|
||||
'getMessageById',
|
||||
'getMessagesBySentAt',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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),
|
||||
});
|
||||
|
|
|
@ -258,7 +258,7 @@ export async function isSwarmMessageDuplicate({
|
|||
sentAt: number;
|
||||
}) {
|
||||
try {
|
||||
const result = await Data.getMessageBySenderAndTimestamp({
|
||||
const result = await Data.getMessageBySenderAndSentAt({
|
||||
source,
|
||||
timestamp: sentAt,
|
||||
});
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue