From 240833027314bd38f229bf5f70a92963378c2117 Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 3 Jan 2018 18:25:42 -1000 Subject: Add previewContacts option Allow previewing a contact messages before publishing it --- lib/serve.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/serve.js') diff --git a/lib/serve.js b/lib/serve.js index abf15c3..7c42d0c 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -197,7 +197,7 @@ Serve.prototype.publishVote = function (next) { } } -Serve.prototype.publishContact = function (cb) { +Serve.prototype.publishContact = function (next) { var content = { type: 'contact', contact: this.data.contact, @@ -206,7 +206,14 @@ Serve.prototype.publishContact = function (cb) { if (this.data.block) content.blocking = true if (this.data.unfollow) content.following = false if (this.data.unblock) content.blocking = false - this.publish(content, cb) + if (this.app.previewContacts) { + 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) + } else { + this.publish(content, next) + } } Serve.prototype.publishAttend = function (cb) { -- cgit v1.2.3