diff --git a/lib/redis/database.js b/lib/redis/database.js index a523ea1..c9557c8 100644 --- a/lib/redis/database.js +++ b/lib/redis/database.js @@ -259,9 +259,9 @@ const onPadUpdate = (meetingId, groupId, padId, rev) => { const change = diff(database[meetingId].groups[groupId].pads[padId].html, html); if (change) { database[meetingId].groups[groupId].pads[padId].html = html; - logger.info(ids.PAD, 'content', { meetingId, groupId, padId, rev, ...change }); + logger.info(ids.PAD, 'content', { meetingId, groupId, padId, rev, html, ...change }); - sender.send('padContent', meetingId, { groupId, padId, rev, ...change }); + sender.send('padContent', meetingId, { groupId, padId, rev, html, ...change }); } }).catch(() => logger.error(ids.PAD, 'content', { meetingId, groupId, padId, rev })); } @@ -609,7 +609,7 @@ const deleteGroup = (meetingId, { groupId }) => { }); }; -const createPad = (meetingId, groupId, { name }) => { +const createPad = (meetingId, groupId, { name, initialHtmlContent }) => { return new Promise((resolve, reject) => { if (hasGroup(meetingId, groupId)) { const padId = `${groupId}$${name}`; @@ -636,6 +636,11 @@ const createPad = (meetingId, groupId, { name }) => { logger.trace(ids.PAD, 'created', { meetingId, groupId, padId }); mapper.createPad(meetingId, groupId, padId); + api.call('setHTML', { + padID: padId, html: initialHtmlContent, + }).catch(() => { + logger.error(ids.PAD, 'settingHTML', { meetingId, groupId, padId }); + }); sender.send('padCreated', meetingId, { groupId, padId, name }); diff --git a/lib/redis/handler.js b/lib/redis/handler.js index 6141408..1461c75 100644 --- a/lib/redis/handler.js +++ b/lib/redis/handler.js @@ -145,9 +145,10 @@ const handlePadCreate = (header, body) => { const { groupId, name, + initialHtmlContent, } = body; - database.createPad(meetingId, groupId, { name }).then(() => { + database.createPad(meetingId, groupId, { name, initialHtmlContent }).then(() => { logger.info(ids.PAD, 'created', { meetingId, groupId, name }); }).catch(() => logger.error(ids.PAD, 'creating', { meetingId, body })); };