diff options
Diffstat (limited to 'lib/serve.js')
-rw-r--r-- | lib/serve.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js index e50caa8..7045b30 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -153,6 +153,7 @@ Serve.prototype.go = function () { else if (data.action === 'publish') self.publishJSON(next) else if (data.action === 'contact') self.publishContact(next) else if (data.action === 'want-blobs') self.wantBlobs(next) + else if (data.action === 'poll-position') self.publishPollPosition(next) else if (data.action_vote) self.publishVote(next) else if (data.action_attend) self.publishAttend(next) else next() @@ -225,6 +226,25 @@ Serve.prototype.publishContact = function (next) { } } +Serve.prototype.publishPollPosition = function (cb) { + var content = { + type: 'position', + version: 'v1', + channel: this.data.channel || undefined, + root: this.data.poll_root, + details: { + type: this.data.poll_type, + choice: this.data.poll_choice + } + } + if (this.data.recps) content.recps = this.data.recps.split(',') + var json = JSON.stringify(content, 0, 2) + var q = qs.stringify({text: json, action: 'preview'}) + var url = this.app.render.toUrl('/compose?' + q) + this.redirect(url) + // this.publish(content, cb) +} + Serve.prototype.publishAttend = function (cb) { var content = { type: 'about', |