aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/serve.js16
-rw-r--r--static/styles.css4
2 files changed, 13 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
}
diff --git a/static/styles.css b/static/styles.css
index a0e4e14..55f18af 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -61,6 +61,10 @@ h3.feed-name {
margin: 0;
}
+.recps-input {
+ width: 100%;
+}
+
textarea {
font: inherit;
width: 100%;