Don't add change number notifications to ourselves

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2021-11-18 12:42:32 -08:00 committed by GitHub
parent 96230abde5
commit 0e1b41cc62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 5 deletions

View File

@ -46,7 +46,7 @@ import { sniffImageMimeType } from '../util/sniffImageMimeType';
import { isValidE164 } from '../util/isValidE164';
import type { MIMEType } from '../types/MIME';
import { IMAGE_JPEG, IMAGE_GIF, IMAGE_WEBP } from '../types/MIME';
import { UUID, isValidUuid } from '../types/UUID';
import { UUID, UUIDKind, isValidUuid } from '../types/UUID';
import type { UUIDStringType } from '../types/UUID';
import { deriveAccessKey, decryptProfileName, decryptProfile } from '../Crypto';
import * as Bytes from '../Bytes';
@ -2900,14 +2900,24 @@ export class ConversationModel extends window.Backbone
}
async addChangeNumberNotification(): Promise<void> {
log.info(
`Conversation ${this.idForLogging()}: adding change number notification`
);
const sourceUuid = this.getCheckedUuid(
'Change number notification without uuid'
);
const { storage } = window.textsecure;
if (storage.user.getOurUuidKind(sourceUuid) !== UUIDKind.Unknown) {
log.info(
`Conversation ${this.idForLogging()}: not adding change number ` +
'notification for ourselves'
);
return;
}
log.info(
`Conversation ${this.idForLogging()}: adding change number ` +
`notification for ${sourceUuid.toString()}`
);
const convos = [
this,
...(await window.ConversationController.getAllGroupsInvolvingUuid(