Always provide isGroup/storyId to message-fetching functions

This commit is contained in:
Scott Nonnenberg 2022-05-11 15:20:47 -07:00 committed by GitHub
parent e1392a2cca
commit 69d0ed3309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 74 additions and 37 deletions

View file

@ -1239,12 +1239,12 @@ async function getOlderMessagesByConversation(
sentAt = Number.MAX_VALUE,
storyId,
}: {
isGroup?: boolean;
isGroup: boolean;
limit?: number;
messageId?: string;
receivedAt?: number;
sentAt?: number;
storyId?: string;
storyId: string | undefined;
}
) {
const messages = await channels.getOlderMessagesByConversation(
@ -1280,11 +1280,11 @@ async function getNewerMessagesByConversation(
sentAt = 0,
storyId,
}: {
isGroup?: boolean;
isGroup: boolean;
limit?: number;
receivedAt?: number;
sentAt?: number;
storyId?: UUIDStringType;
storyId: UUIDStringType | undefined;
}
) {
const messages = await channels.getNewerMessagesByConversation(
@ -1344,11 +1344,12 @@ async function getMessageMetricsForConversation(
}
async function getConversationRangeCenteredOnMessage(options: {
conversationId: string;
isGroup: boolean;
limit?: number;
messageId: string;
receivedAt: number;
sentAt?: number;
storyId?: UUIDStringType;
storyId: UUIDStringType | undefined;
}) {
const result = await channels.getConversationRangeCenteredOnMessage(options);
@ -1390,6 +1391,8 @@ async function removeAllMessagesInConversation(
// time so we don't use too much memory.
messages = await getOlderMessagesByConversation(conversationId, {
limit: chunkSize,
isGroup: true,
storyId: undefined,
});
if (!messages.length) {