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,
|
||||
urgency = AttachmentDownloadUrgency.STANDARD,
|
||||
} = 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, {
|
||||
messageId,
|
||||
receivedAt,
|
||||
|
@ -213,10 +223,7 @@ export class AttachmentDownloadManager extends JobManager<CoreAttachmentDownload
|
|||
});
|
||||
|
||||
if (!parseResult.success) {
|
||||
log.error(
|
||||
`AttachmentDownloadManager/addJob(${sentAt}.${attachmentType}): invalid data`,
|
||||
parseResult.error
|
||||
);
|
||||
log.error(`${logId}: invalid data`, parseResult.error);
|
||||
return attachment;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
import * as log from '../../logging/log';
|
||||
import { GiftBadgeStates } from '../../components/conversation/Message';
|
||||
import { StorySendMode, MY_STORY_ID } from '../../types/Stories';
|
||||
import type { ServiceIdString } from '../../types/ServiceId';
|
||||
import type { AciString, ServiceIdString } from '../../types/ServiceId';
|
||||
import {
|
||||
fromAciObject,
|
||||
fromPniObject,
|
||||
|
@ -571,7 +571,7 @@ export class BackupImportStream extends Writable {
|
|||
);
|
||||
}
|
||||
}
|
||||
await Promise.all(attachmentDownloadJobPromises);
|
||||
await Promise.allSettled(attachmentDownloadJobPromises);
|
||||
await AttachmentDownloadManager.saveBatchedJobs();
|
||||
}
|
||||
|
||||
|
@ -1363,6 +1363,7 @@ export class BackupImportStream extends Writable {
|
|||
sentAt -= 1;
|
||||
additionalMessages.push({
|
||||
...attributes,
|
||||
...generateMessageId(incrementMessageCounter()),
|
||||
sent_at: sentAt,
|
||||
...additional,
|
||||
});
|
||||
|
@ -2776,12 +2777,12 @@ export class BackupImportStream extends Writable {
|
|||
}
|
||||
if (update.groupExpirationTimerUpdate) {
|
||||
const { updaterAci, expiresInMs } = update.groupExpirationTimerUpdate;
|
||||
if (!updaterAci || Bytes.isEmpty(updaterAci)) {
|
||||
throw new Error(
|
||||
`${logId}: groupExpirationTimerUpdate was missing updaterAci!`
|
||||
);
|
||||
let sourceServiceId: AciString | undefined;
|
||||
|
||||
if (Bytes.isNotEmpty(updaterAci)) {
|
||||
sourceServiceId = fromAciObject(Aci.fromUuidBytes(updaterAci));
|
||||
}
|
||||
const sourceServiceId = fromAciObject(Aci.fromUuidBytes(updaterAci));
|
||||
|
||||
const expireTimer = expiresInMs
|
||||
? DurationInSeconds.fromMillis(expiresInMs.toNumber())
|
||||
: undefined;
|
||||
|
|
Loading…
Reference in a new issue