mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Improve `Message.upgradeSchema preconditions
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
;(function() {
|
||||
'use strict';
|
||||
|
||||
const { IdleDetector } = Signal;
|
||||
const { IdleDetector, MessageMigration } = Signal;
|
||||
const { Errors, Message } = window.Signal.Types;
|
||||
const { upgradeMessageSchema } = window.Signal.Migrations;
|
||||
|
||||
|
||||
@@ -166,8 +166,13 @@ const toVersion3 = exports._withSchemaVersion(
|
||||
);
|
||||
|
||||
// UpgradeStep
|
||||
exports.upgradeSchema = async (message, { writeAttachmentData } = {}) =>
|
||||
toVersion3(
|
||||
exports.upgradeSchema = async (message, { writeAttachmentData } = {}) => {
|
||||
if (!isFunction(writeAttachmentData)) {
|
||||
throw new TypeError('`context.writeAttachmentData` is required');
|
||||
}
|
||||
|
||||
return toVersion3(
|
||||
await toVersion2(await toVersion1(await toVersion0(message))),
|
||||
{ writeAttachmentData }
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user