aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-12 22:16:07 -0800
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-02-12 22:16:07 -0800
commita84c3c915d68588e5d21647f7cc7dd22241ec326 (patch)
treeeb0cd488c1f9cb8b5b21187b8b8753cade7b5fc9 /lib
parent782eb376f0c664862a849a279cd00967200833f9 (diff)
downloadpatchfoo-a84c3c915d68588e5d21647f7cc7dd22241ec326.tar.gz
patchfoo-a84c3c915d68588e5d21647f7cc7dd22241ec326.zip
Specify privmsg recps manually
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 30bcf68..64f25f0 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -674,7 +674,7 @@ Serve.prototype.wrapPrivate = function (opts) {
return u.hyperwrap(function (thread, cb) {
self.composer({
placeholder: 'private message',
- useRecpsFromMentions: true,
+ private: true,
}, function (err, composer) {
if (err) return cb(err)
cb(null, [
@@ -769,7 +769,8 @@ Serve.prototype.composer = function (opts, cb) {
var done = multicb({pluck: 1, spread: true})
done()(null, h('section.composer',
h('form', {method: 'post', action: opts.id ? '#' + opts.id : ''},
- opts.recps ? self.app.render.privateLine(opts.recps, done()) : '',
+ opts.recps ? self.app.render.privateLine(opts.recps, done()) :
+ opts.private ? h('div', h('input.recps-input', {name: 'recps', value: data.recps || '', placeholder: 'recipient ids'})) : '',
h('textarea', {
id: opts.id,
name: 'text',
@@ -799,11 +800,12 @@ Serve.prototype.composer = function (opts, cb) {
}
var mentions = ssbMentions(data.text)
if (mentions.length) content.mentions = mentions
- if (opts.useRecpsFromMentions) {
- content.recps = [myId].concat(mentions.filter(function (e) {
- return e.link[0] === '@'
- }))
- if (opts.recps) return cb(new Error('got recps in opts and mentions'))
+ if (data.recps != null) {
+ if (opts.recps) return cb(new Error('got recps in opts and data'))
+ content.recps = [myId]
+ String(data.recps).replace(u.ssbRefRegex, function (recp) {
+ if (content.recps.indexOf(recp) === -1) content.recps.push(recp)
+ })
} else {
if (opts.recps) content.recps = opts.recps
}