aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-03 18:25:42 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-04 08:42:53 -1000
commit240833027314bd38f229bf5f70a92963378c2117 (patch)
treec107459a0d1096ec1c5900cfef6e5bf370e1bf04 /lib
parent0f2d21603df91e7285c4a50da9d9dadf95f600b6 (diff)
downloadpatchfoo-240833027314bd38f229bf5f70a92963378c2117.tar.gz
patchfoo-240833027314bd38f229bf5f70a92963378c2117.zip
Add previewContacts option
Allow previewing a contact messages before publishing it
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js1
-rw-r--r--lib/serve.js11
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/app.js b/lib/app.js
index 2606067..f3b1774 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -32,6 +32,7 @@ function App(sbot, config) {
this.msgFilter = conf.filter
this.showPrivates = conf.showPrivates == null ? true : conf.showPrivates
this.previewVotes = conf.previewVotes == null ? false : conf.previewVotes
+ this.previewContacts = conf.previewContacts == null ? false : conf.previewContacts
this.useOoo = conf.ooo == null ? false : conf.ooo
var base = conf.base || '/'
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) {