From 9dcb64b53cd3bff238f463c8eccbc95c30d6c640 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Tue, 3 Apr 2018 23:12:59 -0400 Subject: [PATCH] Initialize schema version upon import --- js/modules/types/message.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/modules/types/message.js b/js/modules/types/message.js index 3de94fa56c3..c428cadc8cf 100644 --- a/js/modules/types/message.js +++ b/js/modules/types/message.js @@ -195,11 +195,13 @@ exports.createImporter = (writeExistingAttachmentData) => { throw new TypeError('"writeExistingAttachmentData" must be a function'); } - return async (message) => { - if (!exports.isValid(message)) { - throw new TypeError('"message" is not valid'); + return async (rawMessage) => { + if (!exports.isValid(rawMessage)) { + throw new TypeError('"rawMessage" is not valid'); } + const message = exports.initializeSchemaVersion(rawMessage); + const { attachments } = message; const hasAttachments = attachments && attachments.length > 0; if (!hasAttachments) {