mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-20 00:18:45 +01:00
Fix some import cycles
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
@@ -637,7 +637,7 @@ export const DataWriter: ServerWritableInterface = {
|
||||
saveConversations,
|
||||
updateConversation,
|
||||
updateConversations,
|
||||
removeConversation,
|
||||
_removeConversation,
|
||||
_removeAllConversations,
|
||||
updateAllConversationColors,
|
||||
removeAllProfileKeyCredentials,
|
||||
@@ -2046,37 +2046,10 @@ function updateConversations(
|
||||
})();
|
||||
}
|
||||
|
||||
function removeConversations(
|
||||
db: WritableDB,
|
||||
ids: ReadonlyArray<string>,
|
||||
persistent: boolean
|
||||
): void {
|
||||
// Our node interface doesn't seem to allow you to replace one single ? with an array
|
||||
db.prepare(
|
||||
`
|
||||
DELETE FROM conversations
|
||||
WHERE id IN ( ${ids.map(() => '?').join(', ')} );
|
||||
`,
|
||||
{ persistent }
|
||||
).run(ids);
|
||||
}
|
||||
|
||||
function removeConversation(db: WritableDB, id: Array<string> | string): void {
|
||||
if (!Array.isArray(id)) {
|
||||
db.prepare('DELETE FROM conversations WHERE id = $id;').run({
|
||||
id,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!id.length) {
|
||||
throw new Error('removeConversation: No ids to delete!');
|
||||
}
|
||||
|
||||
batchMultiVarQuery(db, id, (ids, persistent) =>
|
||||
removeConversations(db, ids, persistent)
|
||||
);
|
||||
function _removeConversation(db: WritableDB, id: string): void {
|
||||
db.prepare('DELETE FROM conversations WHERE id = $id;').run({
|
||||
id,
|
||||
});
|
||||
}
|
||||
|
||||
function _removeAllConversations(db: WritableDB): void {
|
||||
|
||||
Reference in New Issue
Block a user