diff --git a/ts/services/backups/import.ts b/ts/services/backups/import.ts index 745bed16d2..dd250153f4 100644 --- a/ts/services/backups/import.ts +++ b/ts/services/backups/import.ts @@ -297,7 +297,7 @@ export class BackupImportStream extends Writable { await this.#processFrame(frame, { aboutMe: this.#aboutMe }); if (!this.#aboutMe && this.#ourConversation) { - const { serviceId, pni } = this.#ourConversation; + const { serviceId, pni, e164 } = this.#ourConversation; strictAssert( isAciString(serviceId), 'ourConversation serviceId must be ACI' @@ -305,6 +305,7 @@ export class BackupImportStream extends Writable { this.#aboutMe = { aci: serviceId, pni, + e164, }; } } @@ -2336,7 +2337,12 @@ export class BackupImportStream extends Writable { if (updateMessage.expirationTimerChange) { const { expiresInMs } = updateMessage.expirationTimerChange; - const sourceServiceId = author?.serviceId ?? aboutMe.aci; + let sourceServiceId = author?.serviceId; + let source = author?.e164; + if (!sourceServiceId) { + sourceServiceId = aboutMe.aci; + source = aboutMe.e164; + } const expireTimer = DurationInSeconds.fromMillis( expiresInMs?.toNumber() ?? 0 ); @@ -2345,6 +2351,7 @@ export class BackupImportStream extends Writable { message: { type: 'timer-notification', sourceServiceId, + source, flags: SignalService.DataMessage.Flags.EXPIRATION_TIMER_UPDATE, expirationTimerUpdate: { expireTimer, @@ -2506,6 +2513,7 @@ export class BackupImportStream extends Writable { type: 'call-history', callId, sourceServiceId: undefined, + source: undefined, readStatus: ReadStatus.Read, seenStatus: read ? SeenStatus.Seen : SeenStatus.Unseen, }, @@ -2565,6 +2573,7 @@ export class BackupImportStream extends Writable { type: 'call-history', callId, sourceServiceId: undefined, + source: undefined, readStatus: ReadStatus.Read, seenStatus: read ? SeenStatus.Seen : SeenStatus.Unseen, }, @@ -2579,11 +2588,12 @@ export class BackupImportStream extends Writable { groupChange: Backups.IGroupChangeChatUpdate, options: { aboutMe: AboutMe; + author?: ConversationAttributesType; timestamp: number; } ): Promise { const { updates } = groupChange; - const { aboutMe, timestamp } = options; + const { aboutMe, timestamp, author } = options; const logId = `fromGroupUpdateMessage${timestamp}`; const details: Array = []; @@ -3090,9 +3100,13 @@ export class BackupImportStream extends Writable { if (update.groupExpirationTimerUpdate) { const { updaterAci, expiresInMs } = update.groupExpirationTimerUpdate; let sourceServiceId: AciString | undefined; + let source = author?.e164; if (Bytes.isNotEmpty(updaterAci)) { sourceServiceId = fromAciObject(Aci.fromUuidBytes(updaterAci)); + if (sourceServiceId !== author?.serviceId) { + source = undefined; + } } const expireTimer = expiresInMs @@ -3101,6 +3115,7 @@ export class BackupImportStream extends Writable { additionalMessages.push({ type: 'timer-notification', sourceServiceId, + source, flags: SignalService.DataMessage.Flags.EXPIRATION_TIMER_UPDATE, expirationTimerUpdate: { expireTimer, diff --git a/ts/services/backups/types.ts b/ts/services/backups/types.ts index c66e4b710e..31bce45c07 100644 --- a/ts/services/backups/types.ts +++ b/ts/services/backups/types.ts @@ -7,6 +7,7 @@ import type { ConversationColorType } from '../../types/Colors'; export type AboutMe = { aci: AciString; pni?: PniString; + e164?: string; }; export enum BackupType { diff --git a/ts/util/getSenderIdentifier.ts b/ts/util/getSenderIdentifier.ts index 89171297cc..a269ec923a 100644 --- a/ts/util/getSenderIdentifier.ts +++ b/ts/util/getSenderIdentifier.ts @@ -16,7 +16,7 @@ export function getSenderIdentifier({ const conversation = window.ConversationController.lookupOrCreate({ e164: source, serviceId: sourceServiceId, - reason: 'MessageModel.getSenderIdentifier', + reason: `MessageModel.getSenderIdentifier(${sentAt})`, })!; return `${conversation?.id}.${sourceDevice}-${sentAt}`;