Don't add change number notifications to ourselves

This commit is contained in:
Fedor Indutny 2021-11-18 21:26:53 +01:00 committed by GitHub
parent 1ba48512f6
commit d5ae3c94dd
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(