From 2cea6dd8bfa1230c2c7aa48fab6a48af6c148a30 Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 9 Jan 2018 20:44:01 -1000 Subject: Handle multiple line comment thread composers --- lib/serve.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/serve.js b/lib/serve.js index 4923667..7df2da9 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2701,26 +2701,23 @@ Serve.prototype.wrapBinary = function (opts) { }, String(lineNum))), ph('td', ph('pre', self.app.render.highlight(line, ext))) ]), - (lineComments[lineNum] ? - ph('tr', - ph('td', {colspan: 4}, - self.renderLineCommentThread(lineComments[lineNum], id) - ) + lineComments[lineNum] ? ph('tr', + ph('td', {colspan: 4}, + self.renderLineCommentThread(lineComments[lineNum], id) ) - : self.query.comment === id ? - ph('tr', - ph('td', {colspan: 4}, - self.renderLineCommentForm({ - id: id, - line: lineNum, - updateId: updateMsg.key, - repoId: updateMsg.value.content.repo, - commitId: commitId, - filePath: filePath, - }) - ) + ) : '', + self.query.comment === id ? ph('tr', + ph('td', {colspan: 4}, + self.renderLineCommentForm({ + id: id, + line: lineNum, + updateId: updateMsg.key, + repoId: updateMsg.value.content.repo, + commitId: commitId, + filePath: filePath, + }) ) - : '') + ) : '' ] }) ) @@ -2941,6 +2938,11 @@ Serve.prototype.composer = function (opts, cb) { var data = self.data var myId = self.app.sbot.id + if (opts.id && data.composer_id && opts.id !== data.composer_id) { + // don't share data between multiple composers + data = {} + } + if (!data.text && self.query.text) data.text = self.query.text if (!data.action && self.query.action) data.action = self.query.action @@ -3034,6 +3036,7 @@ Serve.prototype.composer = function (opts, cb) { enctype: 'multipart/form-data'}, h('input', {type: 'hidden', name: 'blobs', value: JSON.stringify(blobs)}), + h('input', {type: 'hidden', name: 'composer_id', value: opts.id}), opts.recps ? self.app.render.privateLine(opts.recps, done()) : opts.private ? h('div', h('input.recps-input', {name: 'recps', value: data.recps || '', placeholder: 'recipient ids'})) : '', -- cgit v1.2.3