Clear PNI signature flag on PNI change

This commit is contained in:
Fedor Indutny 2023-10-31 00:25:55 +01:00 committed by GitHub
parent 8045e97995
commit edd6ed5fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -1329,6 +1329,26 @@ export class ConversationController {
}
}
async clearShareMyPhoneNumber(): Promise<void> {
const sharedWith = this.getAll().filter(c => c.get('shareMyPhoneNumber'));
if (sharedWith.length === 0) {
return;
}
log.info(
'ConversationController.clearShareMyPhoneNumber: ' +
`updating ${sharedWith.length} conversations`
);
await window.Signal.Data.updateConversations(
sharedWith.map(c => {
c.unset('shareMyPhoneNumber');
return c.attributes;
})
);
}
// For testing
async _forgetE164(e164: string): Promise<void> {
const { server } = window.textsecure;

View file

@ -1369,6 +1369,7 @@ export default class AccountManager extends EventTarget {
if (oldPni) {
await storage.protocol.removeOurOldPni(oldPni);
await window.ConversationController.clearShareMyPhoneNumber();
}
await storage.user.setPni(pni);