Delete PNI storageID on merge

This commit is contained in:
Fedor Indutny 2023-05-25 00:05:04 +02:00 committed by GitHub
parent 1a737ee605
commit 3c7502213b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 5 deletions

View file

@ -30,6 +30,7 @@ import { MINUTE, SECOND } from './util/durations';
import { getUuidsForE164s } from './util/getUuidsForE164s';
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
import { getTitleNoDefault } from './util/getTitle';
import * as StorageService from './services/storage';
type ConvoMatchType =
| {
@ -1088,6 +1089,20 @@ export class ConversationController {
log.warn(`${logId}: Delete the obsolete conversation from the database`);
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`);
window.MessageController.update((message: MessageModel) => {
if (message.get('conversationId') === obsoleteId) {