Remove only private conversation during secondary registrations steps to keep public chats in db

pull/531/head
sachaaaaa 6 years ago
parent b63d8ec84f
commit 8ce21b13fe

@ -115,6 +115,7 @@ module.exports = {
getAllPrivateConversations, getAllPrivateConversations,
getAllGroupsInvolvingId, getAllGroupsInvolvingId,
removeAllConversations, removeAllConversations,
removeAllPrivateConversations,
searchConversations, searchConversations,
searchMessages, searchMessages,
@ -2657,6 +2658,10 @@ async function removeAllConversations() {
await removeAllFromTable(CONVERSATIONS_TABLE); await removeAllFromTable(CONVERSATIONS_TABLE);
} }
async function removeAllPrivateConversations() {
await db.run(`DELETE FROM ${CONVERSATIONS_TABLE} WHERE type = 'private'`);
}
async function getMessagesNeedingUpgrade(limit, { maxVersion }) { async function getMessagesNeedingUpgrade(limit, { maxVersion }) {
const rows = await db.all( const rows = await db.all(
`SELECT json FROM messages `SELECT json FROM messages

@ -188,6 +188,7 @@ module.exports = {
removeAll, removeAll,
removeAllConfiguration, removeAllConfiguration,
removeAllConversations, removeAllConversations,
removeAllPrivateConversations,
removeOtherData, removeOtherData,
cleanupOrphanedAttachments, cleanupOrphanedAttachments,
@ -1203,6 +1204,10 @@ async function removeAllConversations() {
await channels.removeAllConversations(); await channels.removeAllConversations();
} }
async function removeAllPrivateConversations() {
await channels.removeAllPrivateConversations();
}
async function cleanupOrphanedAttachments() { async function cleanupOrphanedAttachments() {
await callChannel(CLEANUP_ORPHANED_ATTACHMENTS_KEY); await callChannel(CLEANUP_ORPHANED_ATTACHMENTS_KEY);
} }

@ -145,7 +145,7 @@
}, },
async resetRegistration() { async resetRegistration() {
await window.Signal.Data.removeAllIdentityKeys(); await window.Signal.Data.removeAllIdentityKeys();
await window.Signal.Data.removeAllConversations(); await window.Signal.Data.removeAllPrivateConversations();
Whisper.Registration.remove(); Whisper.Registration.remove();
// Do not remove all items since they are only set // Do not remove all items since they are only set
// at startup. // at startup.

Loading…
Cancel
Save