diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-11-23 14:48:00 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-11-23 15:27:25 -1000 |
commit | 544a8927a47bc0e4cc2f925b0dd248668701c906 (patch) | |
tree | 30c1edfed4b7ecee053ff9ebfbac66d64dc32da2 /lib | |
parent | 2c039c372f7ae301f77f62b459f2a73eb86c4699 (diff) | |
download | patchfoo-544a8927a47bc0e4cc2f925b0dd248668701c906.tar.gz patchfoo-544a8927a47bc0e4cc2f925b0dd248668701c906.zip |
Add root and branch to vote messages
ref: %gdDgsa46yHeHkFrCMSUwbRboOA2xFxhMjGqmt48EapM=.sha256
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 4 | ||||
-rw-r--r-- | lib/serve.js | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 5a3723e..ca07dd8 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -220,9 +220,13 @@ RenderMsg.prototype.buttonsCommon = function () { RenderMsg.prototype.voteButton = function (expression) { var chan = this.msg.value.content.channel + var root = this.msg.threadRoot + var branches = u.toArray(this.msg.threadBranches) return [ h('input', {type: 'hidden', name: 'vote_value', value: 1}), h('input', {type: 'hidden', name: 'vote_expression', value: expression}), + h('input', {type: 'hidden', name: 'root', value: root}), + h('input', {type: 'hidden', name: 'branches', value: branches.join(',')}), h('input', {type: 'submit', name: 'action_vote', value: expression})] } diff --git a/lib/serve.js b/lib/serve.js index 4188269..9d59fa4 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -190,6 +190,8 @@ Serve.prototype.publishVote = function (next) { var content = { type: 'vote', channel: this.data.channel || undefined, + root: this.data.root || undefined, + branch: this.data.branches ? this.data.branches.split(',') : undefined, vote: { link: this.data.link, value: Number(this.data.vote_value), @@ -1234,6 +1236,13 @@ Serve.prototype.streamThreadWithComposer = function (opts) { var branches = threadHeads(links, threadRootId) cb(null, pull( pull.values(sort(links)), + pull.map(function (link) { + var o = {} + for (var k in link) o[k] = link[k] + o.threadBranches = branches + o.threadRoot = threadRootId + return o + }), self.renderThread({ msgId: id, branches: branches, |