mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-24 02:18:15 +01:00
eraseAllStorageServiceState: Delete everything, delete in memory
This commit is contained in:
committed by
Jamie Kyle
parent
b7b725f74c
commit
90f0f8e255
@@ -249,7 +249,6 @@ const dataInterface: ServerInterface = {
|
||||
removeAllSessions,
|
||||
getAllSessions,
|
||||
|
||||
eraseStorageServiceStateFromConversations,
|
||||
getConversationCount,
|
||||
saveConversation,
|
||||
saveConversations,
|
||||
@@ -384,6 +383,7 @@ const dataInterface: ServerInterface = {
|
||||
|
||||
removeAll,
|
||||
removeAllConfiguration,
|
||||
eraseStorageServiceState,
|
||||
|
||||
getMessagesNeedingUpgrade,
|
||||
getMessagesWithVisualMediaAttachments,
|
||||
@@ -1621,18 +1621,6 @@ async function getConversationById(
|
||||
return jsonToObject(row.json);
|
||||
}
|
||||
|
||||
async function eraseStorageServiceStateFromConversations(): Promise<void> {
|
||||
const db = getInstance();
|
||||
|
||||
db.prepare<EmptyQuery>(
|
||||
`
|
||||
UPDATE conversations
|
||||
SET
|
||||
json = json_remove(json, '$.storageID', '$.needsStorageServiceSync', '$.unknownFields', '$.storageProfileKey');
|
||||
`
|
||||
).run();
|
||||
}
|
||||
|
||||
function getAllConversationsSync(db = getInstance()): Array<ConversationType> {
|
||||
const rows: ConversationRows = db
|
||||
.prepare<EmptyQuery>(
|
||||
@@ -5583,6 +5571,40 @@ async function removeAllConfiguration(
|
||||
})();
|
||||
}
|
||||
|
||||
async function eraseStorageServiceState(): Promise<void> {
|
||||
const db = getInstance();
|
||||
|
||||
db.exec(`
|
||||
-- Conversations
|
||||
UPDATE conversations
|
||||
SET
|
||||
json = json_remove(json, '$.storageID', '$.needsStorageServiceSync', '$.storageUnknownFields');
|
||||
|
||||
-- Stickers
|
||||
UPDATE sticker_packs
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
|
||||
UPDATE uninstalled_sticker_packs
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
|
||||
-- Story Distribution Lists
|
||||
UPDATE storyDistributions
|
||||
SET
|
||||
storageID = null,
|
||||
storageVersion = null,
|
||||
storageUnknownFields = null,
|
||||
storageNeedsSync = 0;
|
||||
`);
|
||||
}
|
||||
|
||||
const MAX_MESSAGE_MIGRATION_ATTEMPTS = 5;
|
||||
|
||||
async function getMessagesNeedingUpgrade(
|
||||
|
||||
Reference in New Issue
Block a user