Skip to content

Commit

Permalink
Don't add change number notifications to ourselves
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Nov 18, 2021
1 parent 96230ab commit 0e1b41c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions ts/models/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 0e1b41c

Please sign in to comment.