Add support for OutgoingMessageDetails.dateReceived

This commit is contained in:
trevor-signal
2025-08-19 15:44:07 -04:00
committed by GitHub
parent 203a1cc5e3
commit 4ac3f21268
5 changed files with 22 additions and 9 deletions

View File

@@ -234,7 +234,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: 'signalapp/Signal-Message-Backup-Tests'
ref: 'df09e4bfa985c68daf845ad96abae3ae8f9b07ca'
ref: '279370b21fd089956a581c3b027489594135998a'
path: 'backup-integration-tests'
- run: xvfb-run --auto-servernum pnpm run test-electron

View File

@@ -396,6 +396,7 @@ message ChatItem {
message OutgoingMessageDetails {
repeated SendStatus sendStatus = 1;
uint64 dateReceived = 2; // may be different from dateSent for sync messages
}
message DirectionlessMessageDetails {

View File

@@ -2683,9 +2683,15 @@ export class BackupExportStream extends Readable {
sendStateByConversationId = {},
unidentifiedDeliveries = [],
errors = [],
received_at_ms: receivedAtMs,
editMessageReceivedAtMs,
}: Pick<
MessageAttributesType,
'sendStateByConversationId' | 'unidentifiedDeliveries' | 'errors'
| 'sendStateByConversationId'
| 'unidentifiedDeliveries'
| 'errors'
| 'received_at_ms'
| 'editMessageReceivedAtMs'
>,
{ conversationId }: { conversationId: string }
): Backups.ChatItem.IOutgoingMessageDetails {
@@ -2784,8 +2790,12 @@ export class BackupExportStream extends Readable {
sendStatuses.push(sendStatus);
}
const dateReceived = editMessageReceivedAtMs || receivedAtMs;
return {
sendStatus: sendStatuses,
dateReceived:
dateReceived != null ? getSafeLongFromTimestamp(dateReceived) : null,
};
}

View File

@@ -1738,7 +1738,9 @@ export class BackupImportStream extends Writable {
return {
patch: {
sendStateByConversationId,
received_at_ms: timestamp,
received_at_ms:
getCheckedTimestampOrUndefinedFromLong(outgoing.dateReceived) ??
timestamp,
unidentifiedDeliveries: unidentifiedDeliveries.length
? unidentifiedDeliveries
: undefined,

View File

@@ -132,7 +132,7 @@ describe('backup/bubble messages', () => {
type: 'outgoing',
readStatus: ReadStatus.Read,
received_at: 3,
received_at_ms: 3,
received_at_ms: 43,
seenStatus: SeenStatus.Seen,
sent_at: 3,
sourceServiceId: OUR_ACI,
@@ -144,14 +144,14 @@ describe('backup/bubble messages', () => {
unidentifiedDeliveries: [CONTACT_A],
timestamp: 3,
editMessageTimestamp: 5,
editMessageReceivedAtMs: 5,
editMessageReceivedAtMs: 45,
body: 'd',
editHistory: [
{
body: 'd',
timestamp: 5,
received_at: 5,
received_at_ms: 5,
received_at_ms: 45,
sendStateByConversationId: {
[contactA.id]: {
status: SendStatus.Delivered,
@@ -162,7 +162,7 @@ describe('backup/bubble messages', () => {
body: 'c',
timestamp: 4,
received_at: 4,
received_at_ms: 4,
received_at_ms: 44,
sendStateByConversationId: {
[contactA.id]: {
status: SendStatus.Viewed,
@@ -173,7 +173,7 @@ describe('backup/bubble messages', () => {
body: 'b',
timestamp: 3,
received_at: 3,
received_at_ms: 3,
received_at_ms: 43,
sendStateByConversationId: {
[contactA.id]: {
status: SendStatus.Viewed,
@@ -468,7 +468,7 @@ describe('backup/bubble messages', () => {
id: generateGuid(),
type: 'outgoing',
received_at: 3,
received_at_ms: 3,
received_at_ms: 4,
sent_at: 3,
sourceServiceId: OUR_ACI,
sendStateByConversationId: {