Initialize schema version upon import

This commit is contained in:
Daniel Gasienica 2018-04-03 23:12:59 -04:00
parent cfad983d08
commit 9dcb64b53c

View file

@ -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) {