From a84c3c915d68588e5d21647f7cc7dd22241ec326 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 12 Feb 2017 22:16:07 -0800 Subject: Specify privmsg recps manually --- lib/serve.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/serve.js') 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 } -- cgit v1.2.3