Fix some import cycles

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-03-27 13:41:39 -05:00
committed by GitHub
parent 0adf48ecf4
commit 028290cb1c
27 changed files with 229 additions and 207 deletions

View File

@@ -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 {