Delete PNI storageID on merge
This commit is contained in:
parent
1a737ee605
commit
3c7502213b
5 changed files with 35 additions and 5 deletions
|
@ -189,7 +189,7 @@
|
||||||
"@electron/fuses": "1.5.0",
|
"@electron/fuses": "1.5.0",
|
||||||
"@formatjs/intl": "2.6.7",
|
"@formatjs/intl": "2.6.7",
|
||||||
"@mixer/parallel-prettier": "2.0.3",
|
"@mixer/parallel-prettier": "2.0.3",
|
||||||
"@signalapp/mock-server": "2.20.0",
|
"@signalapp/mock-server": "2.21.1",
|
||||||
"@storybook/addon-a11y": "6.5.6",
|
"@storybook/addon-a11y": "6.5.6",
|
||||||
"@storybook/addon-actions": "6.5.6",
|
"@storybook/addon-actions": "6.5.6",
|
||||||
"@storybook/addon-controls": "6.5.6",
|
"@storybook/addon-controls": "6.5.6",
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { MINUTE, SECOND } from './util/durations';
|
||||||
import { getUuidsForE164s } from './util/getUuidsForE164s';
|
import { getUuidsForE164s } from './util/getUuidsForE164s';
|
||||||
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
|
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
|
||||||
import { getTitleNoDefault } from './util/getTitle';
|
import { getTitleNoDefault } from './util/getTitle';
|
||||||
|
import * as StorageService from './services/storage';
|
||||||
|
|
||||||
type ConvoMatchType =
|
type ConvoMatchType =
|
||||||
| {
|
| {
|
||||||
|
@ -1088,6 +1089,20 @@ export class ConversationController {
|
||||||
log.warn(`${logId}: Delete the obsolete conversation from the database`);
|
log.warn(`${logId}: Delete the obsolete conversation from the database`);
|
||||||
await removeConversation(obsoleteId);
|
await removeConversation(obsoleteId);
|
||||||
|
|
||||||
|
const obsoleteStorageID = obsolete.get('storageID');
|
||||||
|
|
||||||
|
if (obsoleteStorageID) {
|
||||||
|
log.warn(
|
||||||
|
`${logId}: Obsolete conversation was in storage service, scheduling removal`
|
||||||
|
);
|
||||||
|
|
||||||
|
const obsoleteStorageVersion = obsolete.get('storageVersion');
|
||||||
|
StorageService.addPendingDelete({
|
||||||
|
storageID: obsoleteStorageID,
|
||||||
|
storageVersion: obsoleteStorageVersion,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
log.warn(`${logId}: Update cached messages in MessageController`);
|
log.warn(`${logId}: Update cached messages in MessageController`);
|
||||||
window.MessageController.update((message: MessageModel) => {
|
window.MessageController.update((message: MessageModel) => {
|
||||||
if (message.get('conversationId') === obsoleteId) {
|
if (message.get('conversationId') === obsoleteId) {
|
||||||
|
|
|
@ -1999,3 +1999,16 @@ export const runStorageServiceSyncJob = debounce(() => {
|
||||||
}, `sync v${window.storage.get('manifestVersion')}`)
|
}, `sync v${window.storage.get('manifestVersion')}`)
|
||||||
);
|
);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
export const addPendingDelete = (item: ExtendedStorageID): void => {
|
||||||
|
void storageJobQueue(async () => {
|
||||||
|
const storedPendingDeletes = window.storage.get(
|
||||||
|
'storage-service-pending-deletes',
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
await window.storage.put('storage-service-pending-deletes', [
|
||||||
|
...storedPendingDeletes,
|
||||||
|
item,
|
||||||
|
]);
|
||||||
|
}, `addPendingDelete(${redactExtendedStorageID(item)})`);
|
||||||
|
};
|
||||||
|
|
|
@ -358,6 +358,8 @@ describe('pnp/PNI Signature', function needsName() {
|
||||||
// No notifications
|
// No notifications
|
||||||
const notifications = window.locator('.SystemMessage');
|
const notifications = window.locator('.SystemMessage');
|
||||||
assert.strictEqual(await notifications.count(), 0, 'notifications');
|
assert.strictEqual(await notifications.count(), 0, 'notifications');
|
||||||
|
|
||||||
|
assert.isEmpty(await phone.getOrphanedStorageKeys());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2280,10 +2280,10 @@
|
||||||
node-gyp-build "^4.2.3"
|
node-gyp-build "^4.2.3"
|
||||||
uuid "^8.3.0"
|
uuid "^8.3.0"
|
||||||
|
|
||||||
"@signalapp/mock-server@2.20.0":
|
"@signalapp/mock-server@2.21.1":
|
||||||
version "2.20.0"
|
version "2.21.1"
|
||||||
resolved "https://registry.yarnpkg.com/@signalapp/mock-server/-/mock-server-2.20.0.tgz#073e0ef1a4c077d638440003a66be05feafb8bd3"
|
resolved "https://registry.yarnpkg.com/@signalapp/mock-server/-/mock-server-2.21.1.tgz#31ac756a8db0509cf6065b7c6b8139c7dc54c24d"
|
||||||
integrity sha512-RdwGZOlZLdsNfM3uzpaU/RkpCAhswF74NC96F7Sw1yOE05Ig/4Cpdx9M9gU6XE6ZWLhjPJ/Kll1GaKK+WPSwBw==
|
integrity sha512-pycdxIyv8/vPJSl5GZkTTbeFHVq3keefpfuqhVN6ZnP7UfKc0EJ5n3STcTN1V6AdNkdntK82pt47836ln9Wmrg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@signalapp/libsignal-client" "^0.24.0"
|
"@signalapp/libsignal-client" "^0.24.0"
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue