aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/serve.js')
-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
}