refactor: getDisappearingUnreadByConversation

to getUnreadDisappearingByConversation since reading causes disappearing
pull/2971/head
William Grant 2 years ago
parent e66e9961e1
commit 73cceab31f

@ -345,11 +345,11 @@ async function getUnreadByConversation(
return new MessageCollection(messages);
}
async function getDisappearingUnreadByConversation(
async function getUnreadDisappearingByConversation(
conversationId: string,
sentBeforeTimestamp: number
): Promise<MessageCollection> {
const messages = await channels.getDisappearingUnreadByConversation(
const messages = await channels.getUnreadDisappearingByConversation(
conversationId,
sentBeforeTimestamp
);
@ -806,7 +806,7 @@ export const Data = {
getMessageByServerId,
filterAlreadyFetchedOpengroupMessage,
getUnreadByConversation,
getDisappearingUnreadByConversation,
getUnreadDisappearingByConversation,
getUnreadCountByConversation,
markAllAsReadByConversationNoExpiration,
getMessageCountByType,

@ -42,7 +42,7 @@ const channelsToMake = new Set([
'removeMessage',
'removeMessagesByIds',
'getUnreadByConversation',
'getDisappearingUnreadByConversation',
'getUnreadDisappearingByConversation',
'markAllAsReadByConversationNoExpiration',
'getUnreadCountByConversation',
'getMessageCountByType',

@ -1,7 +1,7 @@
import * as BetterSqlite3 from '@signalapp/better-sqlite3';
import { app, clipboard, dialog, Notification } from 'electron';
import fs from 'fs';
import path from 'path';
import * as BetterSqlite3 from '@signalapp/better-sqlite3';
import rimraf from 'rimraf';
import { base64_variants, from_base64, to_hex } from 'libsodium-wrappers-sumo';
@ -1161,7 +1161,7 @@ function getUnreadByConversation(conversationId: string, sentBeforeTimestamp: nu
return map(rows, row => jsonToObject(row.json));
}
function getDisappearingUnreadByConversation(conversationId: string, sentBeforeTimestamp: number) {
function getUnreadDisappearingByConversation(conversationId: string, sentBeforeTimestamp: number) {
const rows = assertGlobalInstance()
.prepare(
`SELECT * FROM ${MESSAGES_TABLE} WHERE
@ -2419,7 +2419,7 @@ export const sqlNode = {
removeMessagesByIds,
removeAllMessagesInConversation,
getUnreadByConversation,
getDisappearingUnreadByConversation,
getUnreadDisappearingByConversation,
markAllAsReadByConversationNoExpiration,
getUnreadCountByConversation,
getMessageCountByType,

@ -5,6 +5,7 @@ import { ConfigDumpData } from '../data/configDump/configDump';
import { Data } from '../data/data';
import { SettingsKey } from '../data/settings-key';
import { ConversationInteraction } from '../interactions';
import { deleteAllMessagesByConvoIdNoConfirmation } from '../interactions/conversationInteractions';
import { CONVERSATION_PRIORITIES, ConversationTypeEnum } from '../models/conversationAttributes';
import { SignalService } from '../protobuf';
import { ClosedGroup } from '../session';
@ -16,6 +17,7 @@ import { getOpenGroupManager } from '../session/apis/open_group_api/opengroupV2/
import { OpenGroupUtils } from '../session/apis/open_group_api/utils';
import { getOpenGroupV2ConversationId } from '../session/apis/open_group_api/utils/OpenGroupUtils';
import { getSwarmPollingInstance } from '../session/apis/snode_api';
import { getExpiriesFromSnode } from '../session/apis/snode_api/getExpiriesRequest';
import { getConversationController } from '../session/conversations';
import { IncomingMessage } from '../session/messages/incoming/IncomingMessage';
import { Profile, ProfileManager } from '../session/profile_manager/ProfileManager';
@ -39,7 +41,6 @@ import {
isSignInByLinking,
setLastProfileUpdateTimestamp,
} from '../util/storage';
import { deleteAllMessagesByConvoIdNoConfirmation } from '../interactions/conversationInteractions';
// eslint-disable-next-line import/no-unresolved, import/extensions
import { ConfigWrapperObjectTypes } from '../webworker/workers/browser/libsession_worker_functions';
import {
@ -54,7 +55,6 @@ import { addKeyPairToCacheAndDBIfNeeded, handleNewClosedGroup } from './closedGr
import { HexKeyPair } from './keypairs';
import { queueAllCachedFromSource } from './receiver';
import { EnvelopePlus } from './types';
import { getExpiriesFromSnode } from '../session/apis/snode_api/getExpiriesRequest';
function groupByVariant(
incomingConfigs: Array<IncomingMessage<SignalService.ISharedConfigMessage>>
@ -735,7 +735,7 @@ async function applyConvoVolatileUpdateFromWrapper(
foundConvo.getExpirationMode() === 'legacy') &&
foundConvo.getExpireTimer() > 0
) {
const messages2Expire = await Data.getDisappearingUnreadByConversation(
const messages2Expire = await Data.getUnreadDisappearingByConversation(
convoId,
lastReadMessageTimestamp
);

Loading…
Cancel
Save