Always provide isGroup/storyId to message-fetching functions
This commit is contained in:
parent
e1392a2cca
commit
69d0ed3309
6 changed files with 74 additions and 37 deletions
|
@ -1490,6 +1490,7 @@ export class ConversationModel extends window.Backbone
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
isGroup: isGroup(this.attributes),
|
isGroup: isGroup(this.attributes),
|
||||||
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const cleaned: Array<MessageModel> = await this.cleanModels(messages);
|
const cleaned: Array<MessageModel> = await this.cleanModels(messages);
|
||||||
|
@ -1541,10 +1542,11 @@ export class ConversationModel extends window.Backbone
|
||||||
const sentAt = message.sent_at;
|
const sentAt = message.sent_at;
|
||||||
const models = await getOlderMessagesByConversation(conversationId, {
|
const models = await getOlderMessagesByConversation(conversationId, {
|
||||||
isGroup: isGroup(this.attributes),
|
isGroup: isGroup(this.attributes),
|
||||||
|
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
||||||
|
messageId: oldestMessageId,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
sentAt,
|
sentAt,
|
||||||
messageId: oldestMessageId,
|
storyId: undefined,
|
||||||
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (models.length < 1) {
|
if (models.length < 1) {
|
||||||
|
@ -1595,9 +1597,10 @@ export class ConversationModel extends window.Backbone
|
||||||
const sentAt = message.sent_at;
|
const sentAt = message.sent_at;
|
||||||
const models = await getNewerMessagesByConversation(conversationId, {
|
const models = await getNewerMessagesByConversation(conversationId, {
|
||||||
isGroup: isGroup(this.attributes),
|
isGroup: isGroup(this.attributes),
|
||||||
|
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
sentAt,
|
sentAt,
|
||||||
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (models.length < 1) {
|
if (models.length < 1) {
|
||||||
|
@ -1651,10 +1654,12 @@ export class ConversationModel extends window.Backbone
|
||||||
const { older, newer, metrics } =
|
const { older, newer, metrics } =
|
||||||
await getConversationRangeCenteredOnMessage({
|
await getConversationRangeCenteredOnMessage({
|
||||||
conversationId,
|
conversationId,
|
||||||
|
isGroup: isGroup(this.attributes),
|
||||||
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
limit: MESSAGE_LOAD_CHUNK_SIZE,
|
||||||
|
messageId,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
sentAt,
|
sentAt,
|
||||||
messageId,
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
const all = [...older, message, ...newer];
|
const all = [...older, message, ...newer];
|
||||||
|
|
||||||
|
@ -2035,9 +2040,10 @@ export class ConversationModel extends window.Backbone
|
||||||
{
|
{
|
||||||
isGroup: isGroup(this.attributes),
|
isGroup: isGroup(this.attributes),
|
||||||
limit: 100,
|
limit: 100,
|
||||||
|
messageId: first ? first.id : undefined,
|
||||||
receivedAt: first ? first.received_at : undefined,
|
receivedAt: first ? first.received_at : undefined,
|
||||||
sentAt: first ? first.sent_at : undefined,
|
sentAt: first ? first.sent_at : undefined,
|
||||||
messageId: first ? first.id : undefined,
|
storyId: undefined,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1239,12 +1239,12 @@ async function getOlderMessagesByConversation(
|
||||||
sentAt = Number.MAX_VALUE,
|
sentAt = Number.MAX_VALUE,
|
||||||
storyId,
|
storyId,
|
||||||
}: {
|
}: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: string;
|
storyId: string | undefined;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const messages = await channels.getOlderMessagesByConversation(
|
const messages = await channels.getOlderMessagesByConversation(
|
||||||
|
@ -1280,11 +1280,11 @@ async function getNewerMessagesByConversation(
|
||||||
sentAt = 0,
|
sentAt = 0,
|
||||||
storyId,
|
storyId,
|
||||||
}: {
|
}: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
const messages = await channels.getNewerMessagesByConversation(
|
const messages = await channels.getNewerMessagesByConversation(
|
||||||
|
@ -1344,11 +1344,12 @@ async function getMessageMetricsForConversation(
|
||||||
}
|
}
|
||||||
async function getConversationRangeCenteredOnMessage(options: {
|
async function getConversationRangeCenteredOnMessage(options: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId: string;
|
messageId: string;
|
||||||
receivedAt: number;
|
receivedAt: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}) {
|
}) {
|
||||||
const result = await channels.getConversationRangeCenteredOnMessage(options);
|
const result = await channels.getConversationRangeCenteredOnMessage(options);
|
||||||
|
|
||||||
|
@ -1390,6 +1391,8 @@ async function removeAllMessagesInConversation(
|
||||||
// time so we don't use too much memory.
|
// time so we don't use too much memory.
|
||||||
messages = await getOlderMessagesByConversation(conversationId, {
|
messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
limit: chunkSize,
|
limit: chunkSize,
|
||||||
|
isGroup: true,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!messages.length) {
|
if (!messages.length) {
|
||||||
|
|
|
@ -628,32 +628,33 @@ export type ServerInterface = DataInterface & {
|
||||||
|
|
||||||
getOlderMessagesByConversation: (
|
getOlderMessagesByConversation: (
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options?: {
|
options: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: string;
|
storyId: string | undefined;
|
||||||
}
|
}
|
||||||
) => Promise<Array<MessageTypeUnhydrated>>;
|
) => Promise<Array<MessageTypeUnhydrated>>;
|
||||||
getNewerMessagesByConversation: (
|
getNewerMessagesByConversation: (
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options?: {
|
options: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}
|
}
|
||||||
) => Promise<Array<MessageTypeUnhydrated>>;
|
) => Promise<Array<MessageTypeUnhydrated>>;
|
||||||
getConversationRangeCenteredOnMessage: (options: {
|
getConversationRangeCenteredOnMessage: (options: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId: string;
|
messageId: string;
|
||||||
receivedAt: number;
|
receivedAt: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}) => Promise<{
|
}) => Promise<{
|
||||||
older: Array<MessageTypeUnhydrated>;
|
older: Array<MessageTypeUnhydrated>;
|
||||||
newer: Array<MessageTypeUnhydrated>;
|
newer: Array<MessageTypeUnhydrated>;
|
||||||
|
@ -701,31 +702,32 @@ export type ClientInterface = DataInterface & {
|
||||||
getOlderMessagesByConversation: (
|
getOlderMessagesByConversation: (
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options: {
|
options: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: string;
|
storyId: string | undefined;
|
||||||
}
|
}
|
||||||
) => Promise<Array<MessageAttributesType>>;
|
) => Promise<Array<MessageAttributesType>>;
|
||||||
getNewerMessagesByConversation: (
|
getNewerMessagesByConversation: (
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options: {
|
options: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}
|
}
|
||||||
) => Promise<Array<MessageAttributesType>>;
|
) => Promise<Array<MessageAttributesType>>;
|
||||||
getConversationRangeCenteredOnMessage: (options: {
|
getConversationRangeCenteredOnMessage: (options: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId: string;
|
messageId: string;
|
||||||
receivedAt: number;
|
receivedAt: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}) => Promise<{
|
}) => Promise<{
|
||||||
older: Array<MessageAttributesType>;
|
older: Array<MessageAttributesType>;
|
||||||
newer: Array<MessageAttributesType>;
|
newer: Array<MessageAttributesType>;
|
||||||
|
|
|
@ -2352,13 +2352,13 @@ async function _removeAllReactions(): Promise<void> {
|
||||||
|
|
||||||
async function getOlderMessagesByConversation(
|
async function getOlderMessagesByConversation(
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options?: {
|
options: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: string;
|
storyId: string | undefined;
|
||||||
}
|
}
|
||||||
): Promise<Array<MessageTypeUnhydrated>> {
|
): Promise<Array<MessageTypeUnhydrated>> {
|
||||||
return getOlderMessagesByConversationSync(conversationId, options);
|
return getOlderMessagesByConversationSync(conversationId, options);
|
||||||
|
@ -2373,13 +2373,13 @@ function getOlderMessagesByConversationSync(
|
||||||
sentAt = Number.MAX_VALUE,
|
sentAt = Number.MAX_VALUE,
|
||||||
storyId,
|
storyId,
|
||||||
}: {
|
}: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId?: string;
|
messageId?: string;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: string;
|
storyId: string | undefined;
|
||||||
} = {}
|
}
|
||||||
): Array<MessageTypeUnhydrated> {
|
): Array<MessageTypeUnhydrated> {
|
||||||
const db = getInstance();
|
const db = getInstance();
|
||||||
|
|
||||||
|
@ -2453,11 +2453,12 @@ async function getOlderStories({
|
||||||
|
|
||||||
async function getNewerMessagesByConversation(
|
async function getNewerMessagesByConversation(
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
options?: {
|
options: {
|
||||||
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}
|
}
|
||||||
): Promise<Array<MessageTypeUnhydrated>> {
|
): Promise<Array<MessageTypeUnhydrated>> {
|
||||||
return getNewerMessagesByConversationSync(conversationId, options);
|
return getNewerMessagesByConversationSync(conversationId, options);
|
||||||
|
@ -2471,12 +2472,12 @@ function getNewerMessagesByConversationSync(
|
||||||
sentAt = 0,
|
sentAt = 0,
|
||||||
storyId,
|
storyId,
|
||||||
}: {
|
}: {
|
||||||
isGroup?: boolean;
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
receivedAt?: number;
|
receivedAt?: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
} = {}
|
}
|
||||||
): Array<MessageTypeUnhydrated> {
|
): Array<MessageTypeUnhydrated> {
|
||||||
const db = getInstance();
|
const db = getInstance();
|
||||||
const rows: JSONRows = db
|
const rows: JSONRows = db
|
||||||
|
@ -2830,6 +2831,7 @@ function getMessageMetricsForConversationSync(
|
||||||
|
|
||||||
async function getConversationRangeCenteredOnMessage({
|
async function getConversationRangeCenteredOnMessage({
|
||||||
conversationId,
|
conversationId,
|
||||||
|
isGroup,
|
||||||
limit,
|
limit,
|
||||||
messageId,
|
messageId,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
|
@ -2837,11 +2839,12 @@ async function getConversationRangeCenteredOnMessage({
|
||||||
storyId,
|
storyId,
|
||||||
}: {
|
}: {
|
||||||
conversationId: string;
|
conversationId: string;
|
||||||
|
isGroup: boolean;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
messageId: string;
|
messageId: string;
|
||||||
receivedAt: number;
|
receivedAt: number;
|
||||||
sentAt?: number;
|
sentAt?: number;
|
||||||
storyId?: UUIDStringType;
|
storyId: UUIDStringType | undefined;
|
||||||
}): Promise<{
|
}): Promise<{
|
||||||
older: Array<MessageTypeUnhydrated>;
|
older: Array<MessageTypeUnhydrated>;
|
||||||
newer: Array<MessageTypeUnhydrated>;
|
newer: Array<MessageTypeUnhydrated>;
|
||||||
|
@ -2852,6 +2855,7 @@ async function getConversationRangeCenteredOnMessage({
|
||||||
return db.transaction(() => {
|
return db.transaction(() => {
|
||||||
return {
|
return {
|
||||||
older: getOlderMessagesByConversationSync(conversationId, {
|
older: getOlderMessagesByConversationSync(conversationId, {
|
||||||
|
isGroup,
|
||||||
limit,
|
limit,
|
||||||
messageId,
|
messageId,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
|
@ -2859,6 +2863,7 @@ async function getConversationRangeCenteredOnMessage({
|
||||||
storyId,
|
storyId,
|
||||||
}),
|
}),
|
||||||
newer: getNewerMessagesByConversationSync(conversationId, {
|
newer: getNewerMessagesByConversationSync(conversationId, {
|
||||||
|
isGroup,
|
||||||
limit,
|
limit,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
sentAt,
|
sentAt,
|
||||||
|
|
|
@ -33,6 +33,8 @@ import {
|
||||||
import { useBoundActions } from '../../hooks/useBoundActions';
|
import { useBoundActions } from '../../hooks/useBoundActions';
|
||||||
import { viewSyncJobQueue } from '../../jobs/viewSyncJobQueue';
|
import { viewSyncJobQueue } from '../../jobs/viewSyncJobQueue';
|
||||||
import { viewedReceiptsJobQueue } from '../../jobs/viewedReceiptsJobQueue';
|
import { viewedReceiptsJobQueue } from '../../jobs/viewedReceiptsJobQueue';
|
||||||
|
import { isGroup } from '../../util/whatTypeOfConversation';
|
||||||
|
import { getConversationSelector } from '../selectors/conversations';
|
||||||
|
|
||||||
export type StoryDataType = {
|
export type StoryDataType = {
|
||||||
attachment?: AttachmentType;
|
attachment?: AttachmentType;
|
||||||
|
@ -133,10 +135,11 @@ function loadStoryReplies(
|
||||||
conversationId: string,
|
conversationId: string,
|
||||||
messageId: string
|
messageId: string
|
||||||
): ThunkAction<void, RootStateType, unknown, LoadStoryRepliesActionType> {
|
): ThunkAction<void, RootStateType, unknown, LoadStoryRepliesActionType> {
|
||||||
return async dispatch => {
|
return async (dispatch, getState) => {
|
||||||
|
const conversation = getConversationSelector(getState())(conversationId);
|
||||||
const replies = await dataInterface.getOlderMessagesByConversation(
|
const replies = await dataInterface.getOlderMessagesByConversation(
|
||||||
conversationId,
|
conversationId,
|
||||||
{ limit: 9000, storyId: messageId }
|
{ limit: 9000, storyId: messageId, isGroup: isGroup(conversation) }
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
|
|
|
@ -93,7 +93,9 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 5);
|
assert.lengthOf(await _getAllMessages(), 5);
|
||||||
|
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
|
isGroup: false,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
assert.lengthOf(messages, 3);
|
assert.lengthOf(messages, 3);
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
storyId,
|
storyId,
|
||||||
});
|
});
|
||||||
|
@ -203,6 +206,7 @@ describe('sql/timelineFetches', () => {
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
isGroup: true,
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
assert.lengthOf(messages, 1);
|
assert.lengthOf(messages, 1);
|
||||||
assert.strictEqual(messages[0].id, message3.id);
|
assert.strictEqual(messages[0].id, message3.id);
|
||||||
|
@ -251,9 +255,11 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
assert.lengthOf(messages, 1);
|
assert.lengthOf(messages, 1);
|
||||||
assert.strictEqual(messages[0].id, message1.id);
|
assert.strictEqual(messages[0].id, message1.id);
|
||||||
|
@ -302,9 +308,11 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.lengthOf(messages, 2);
|
assert.lengthOf(messages, 2);
|
||||||
|
@ -357,10 +365,12 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getOlderMessagesByConversation(conversationId, {
|
const messages = await getOlderMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
|
messageId: message2.id,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
messageId: message2.id,
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.lengthOf(messages, 1);
|
assert.lengthOf(messages, 1);
|
||||||
|
@ -433,7 +443,9 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 5);
|
assert.lengthOf(await _getAllMessages(), 5);
|
||||||
|
|
||||||
const messages = await getNewerMessagesByConversation(conversationId, {
|
const messages = await getNewerMessagesByConversation(conversationId, {
|
||||||
|
isGroup: false,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.lengthOf(messages, 3);
|
assert.lengthOf(messages, 3);
|
||||||
|
@ -487,6 +499,7 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getNewerMessagesByConversation(conversationId, {
|
const messages = await getNewerMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
storyId,
|
storyId,
|
||||||
});
|
});
|
||||||
|
@ -538,9 +551,11 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getNewerMessagesByConversation(conversationId, {
|
const messages = await getNewerMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
assert.lengthOf(messages, 1);
|
assert.lengthOf(messages, 1);
|
||||||
assert.strictEqual(messages[0].id, message3.id);
|
assert.strictEqual(messages[0].id, message3.id);
|
||||||
|
@ -593,6 +608,7 @@ describe('sql/timelineFetches', () => {
|
||||||
const messages = await getNewerMessagesByConversation(conversationId, {
|
const messages = await getNewerMessagesByConversation(conversationId, {
|
||||||
isGroup: true,
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
|
storyId: undefined,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
});
|
});
|
||||||
|
@ -643,9 +659,11 @@ describe('sql/timelineFetches', () => {
|
||||||
assert.lengthOf(await _getAllMessages(), 3);
|
assert.lengthOf(await _getAllMessages(), 3);
|
||||||
|
|
||||||
const messages = await getNewerMessagesByConversation(conversationId, {
|
const messages = await getNewerMessagesByConversation(conversationId, {
|
||||||
|
isGroup: true,
|
||||||
limit: 5,
|
limit: 5,
|
||||||
receivedAt: target,
|
receivedAt: target,
|
||||||
sentAt: target,
|
sentAt: target,
|
||||||
|
storyId: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
assert.lengthOf(messages, 2);
|
assert.lengthOf(messages, 2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue