diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-08-12 16:50:47 -0700 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-08-12 16:50:47 -0700 |
commit | 2e87d6f2847b51ee3828ea6fe18df2ebaf4957d3 (patch) | |
tree | a975eed5bae115e650a512f7453e426c53fe6ba5 /lib | |
parent | 151b874555bc8a196a359921f7e4ea7558e277f6 (diff) | |
download | patchfoo-2e87d6f2847b51ee3828ea6fe18df2ebaf4957d3.tar.gz patchfoo-2e87d6f2847b51ee3828ea6fe18df2ebaf4957d3.zip |
Show if private message author is not a recipient
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 6 | ||||
-rw-r--r-- | lib/render.js | 5 | ||||
-rw-r--r-- | lib/serve.js | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index f351039..89a5f90 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -188,10 +188,12 @@ RenderMsg.prototype.sync = function (cb) { RenderMsg.prototype.recpsLine = function (cb) { if (!this.value.private) return cb(), '' var author = this.value.author - var recpsNotSelf = u.toArray(this.c.recps).filter(function (link) { + var recps = u.toArray(this.c.recps) + var recpsNotAuthor = recps.filter(function (link) { return u.linkDest(link) !== author }) - return this.render.privateLine(recpsNotSelf, cb) + var isAuthorRecp = recpsNotAuthor.length < recps.length + return this.render.privateLine(recpsNotAuthor, isAuthorRecp, cb) } RenderMsg.prototype.recpsIds = function () { diff --git a/lib/render.js b/lib/render.js index a967ee4..0a20b10 100644 --- a/lib/render.js +++ b/lib/render.js @@ -307,11 +307,14 @@ Render.prototype.idLink = function (link, cb) { return a } -Render.prototype.privateLine = function (recps, cb) { +Render.prototype.privateLine = function (recps, isAuthorRecp, cb) { var done = multicb({pluck: 1, spread: true}) var self = this var el = h('div.recps', self.lockIcon(), + !isAuthorRecp ? [ + h('span', {title: 'Author is not a recipient'}, '[!]'), ' ' + ] : '', Array.isArray(recps) ? recps.map(function (recp) { return [' ', self.idLink(recp, done())] diff --git a/lib/serve.js b/lib/serve.js index e059f54..2eba468 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -3167,7 +3167,7 @@ Serve.prototype.composer = function (opts, cb) { h('input', {type: 'hidden', name: 'blobs', value: JSON.stringify(blobs)}), h('input', {type: 'hidden', name: 'composer_id', value: opts.id}), - opts.recps ? self.app.render.privateLine(opts.recps, done()) : + opts.recps ? self.app.render.privateLine(opts.recps, true, done()) : opts.private ? h('div', h('input.recps-input', {name: 'recps', value: data.recps || '', placeholder: 'recipient ids'})) : '', channel != null ? |