diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-03 18:25:42 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-04 08:42:53 -1000 |
commit | 240833027314bd38f229bf5f70a92963378c2117 (patch) | |
tree | c107459a0d1096ec1c5900cfef6e5bf370e1bf04 /lib | |
parent | 0f2d21603df91e7285c4a50da9d9dadf95f600b6 (diff) | |
download | patchfoo-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.js | 1 | ||||
-rw-r--r-- | lib/serve.js | 11 |
2 files changed, 10 insertions, 2 deletions
@@ -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) { |