Allow empty groupExpirationTimerUpdate.updaterAci in backup import
Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
parent
89ff99d8f7
commit
634270bd80
3 changed files with 37 additions and 11 deletions
|
@ -103,3 +103,21 @@ export function SetBySync(args: Props): JSX.Element {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetByUnknownContact(args: Props): JSX.Element {
|
||||||
|
const props: Props = {
|
||||||
|
...args,
|
||||||
|
disabled: false,
|
||||||
|
expireTimer: DurationInSeconds.fromHours(1),
|
||||||
|
type: 'fromMember',
|
||||||
|
title: 'Unknown contact',
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TimerNotification {...props} />
|
||||||
|
<div style={{ padding: '1em' }} />
|
||||||
|
<TimerNotification {...props} disabled />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -192,6 +192,16 @@ export class AttachmentDownloadManager extends JobManager<CoreAttachmentDownload
|
||||||
source,
|
source,
|
||||||
urgency = AttachmentDownloadUrgency.STANDARD,
|
urgency = AttachmentDownloadUrgency.STANDARD,
|
||||||
} = newJobData;
|
} = newJobData;
|
||||||
|
|
||||||
|
const logId = `AttachmentDownloadManager/addJob(${sentAt}.${attachmentType})`;
|
||||||
|
|
||||||
|
if (attachment.error && source === AttachmentDownloadSource.BACKUP_IMPORT) {
|
||||||
|
log.info(
|
||||||
|
`${logId}: skipping InvalidAttachmentLocator from backup import`
|
||||||
|
);
|
||||||
|
return attachment;
|
||||||
|
}
|
||||||
|
|
||||||
const parseResult = safeParsePartial(coreAttachmentDownloadJobSchema, {
|
const parseResult = safeParsePartial(coreAttachmentDownloadJobSchema, {
|
||||||
messageId,
|
messageId,
|
||||||
receivedAt,
|
receivedAt,
|
||||||
|
@ -213,10 +223,7 @@ export class AttachmentDownloadManager extends JobManager<CoreAttachmentDownload
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!parseResult.success) {
|
if (!parseResult.success) {
|
||||||
log.error(
|
log.error(`${logId}: invalid data`, parseResult.error);
|
||||||
`AttachmentDownloadManager/addJob(${sentAt}.${attachmentType}): invalid data`,
|
|
||||||
parseResult.error
|
|
||||||
);
|
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import {
|
||||||
import * as log from '../../logging/log';
|
import * as log from '../../logging/log';
|
||||||
import { GiftBadgeStates } from '../../components/conversation/Message';
|
import { GiftBadgeStates } from '../../components/conversation/Message';
|
||||||
import { StorySendMode, MY_STORY_ID } from '../../types/Stories';
|
import { StorySendMode, MY_STORY_ID } from '../../types/Stories';
|
||||||
import type { ServiceIdString } from '../../types/ServiceId';
|
import type { AciString, ServiceIdString } from '../../types/ServiceId';
|
||||||
import {
|
import {
|
||||||
fromAciObject,
|
fromAciObject,
|
||||||
fromPniObject,
|
fromPniObject,
|
||||||
|
@ -571,7 +571,7 @@ export class BackupImportStream extends Writable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Promise.all(attachmentDownloadJobPromises);
|
await Promise.allSettled(attachmentDownloadJobPromises);
|
||||||
await AttachmentDownloadManager.saveBatchedJobs();
|
await AttachmentDownloadManager.saveBatchedJobs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1363,6 +1363,7 @@ export class BackupImportStream extends Writable {
|
||||||
sentAt -= 1;
|
sentAt -= 1;
|
||||||
additionalMessages.push({
|
additionalMessages.push({
|
||||||
...attributes,
|
...attributes,
|
||||||
|
...generateMessageId(incrementMessageCounter()),
|
||||||
sent_at: sentAt,
|
sent_at: sentAt,
|
||||||
...additional,
|
...additional,
|
||||||
});
|
});
|
||||||
|
@ -2776,12 +2777,12 @@ export class BackupImportStream extends Writable {
|
||||||
}
|
}
|
||||||
if (update.groupExpirationTimerUpdate) {
|
if (update.groupExpirationTimerUpdate) {
|
||||||
const { updaterAci, expiresInMs } = update.groupExpirationTimerUpdate;
|
const { updaterAci, expiresInMs } = update.groupExpirationTimerUpdate;
|
||||||
if (!updaterAci || Bytes.isEmpty(updaterAci)) {
|
let sourceServiceId: AciString | undefined;
|
||||||
throw new Error(
|
|
||||||
`${logId}: groupExpirationTimerUpdate was missing updaterAci!`
|
if (Bytes.isNotEmpty(updaterAci)) {
|
||||||
);
|
sourceServiceId = fromAciObject(Aci.fromUuidBytes(updaterAci));
|
||||||
}
|
}
|
||||||
const sourceServiceId = fromAciObject(Aci.fromUuidBytes(updaterAci));
|
|
||||||
const expireTimer = expiresInMs
|
const expireTimer = expiresInMs
|
||||||
? DurationInSeconds.fromMillis(expiresInMs.toNumber())
|
? DurationInSeconds.fromMillis(expiresInMs.toNumber())
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
Loading…
Reference in a new issue