softAssert that messageId is always a UUID

This commit is contained in:
Josh Perez 2022-08-11 17:02:25 -04:00 committed by GitHub
parent 465bdad2bf
commit f9c2e9b0af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,7 +26,7 @@ import { tapToViewMessagesDeletionService } from '../services/tapToViewMessagesD
import * as Bytes from '../Bytes';
import { CURRENT_SCHEMA_VERSION } from '../types/Message2';
import { createBatcher } from '../util/batcher';
import { assert, strictAssert } from '../util/assert';
import { assert, softAssert, strictAssert } from '../util/assert';
import { mapObjectWithSpec } from '../util/mapObjectWithSpec';
import type { ObjectMappingSpecType } from '../util/mapObjectWithSpec';
import { cleanDataForIpc } from './cleanDataForIpc';
@ -38,6 +38,7 @@ import type { ProcessGroupCallRingRequestResult } from '../types/Calling';
import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration';
import createTaskWithTimeout from '../textsecure/TaskWithTimeout';
import * as log from '../logging/log';
import { isValidUuid } from '../types/UUID';
import type { StoredJob } from '../jobs/types';
import { formatJobForInsert } from '../jobs/formatJobForInsert';
@ -1169,6 +1170,8 @@ async function saveMessage(
jobToInsert: options.jobToInsert && formatJobForInsert(options.jobToInsert),
});
softAssert(isValidUuid(id), 'saveMessage: messageId is not a UUID');
expiringMessagesDeletionService.update();
tapToViewMessagesDeletionService.update();