aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-05 19:34:01 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-11-06 12:22:55 -0500
commit781358df92665a6806ef6946d8fd140f88cf6302 (patch)
treefa88c8c80ae5d55359030b5477a0d045cfa6d65a /lib
parentf07c034d442bc8a3610e983e0976f24ea839bb92 (diff)
downloadpatchfoo-781358df92665a6806ef6946d8fd140f88cf6302.tar.gz
patchfoo-781358df92665a6806ef6946d8fd140f88cf6302.zip
Special case about messages for names
Diffstat (limited to 'lib')
-rw-r--r--lib/render-msg.js31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 1fd4d83..88224f0 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -464,11 +464,23 @@ var knownAboutProps = {
}
RenderMsg.prototype.about = function (cb) {
+ var keys = Object.keys(this.c).sort().join()
+ var isSelf = this.c.about === this.msg.value.author
+
+ if (keys === 'about,name,type') {
+ return this.wrapMini([
+ isSelf ?
+ 'self-identifies as ' :
+ ['identifies ', h('a', {href: this.toUrl(this.c.about)}, truncate(this.c.about, 10)), ' as '],
+ h('ins', this.c.name)
+ ], cb)
+ }
+
var done = multicb({pluck: 1, spread: true})
var elCb = done()
var isAttendingMsg = u.linkDest(this.c.attendee) === this.msg.value.author
- && Object.keys(this.c).sort().join() === 'about,attendee,type'
+ && keys === 'about,attendee,type'
if (isAttendingMsg) {
var attending = !this.c.attendee.remove
this.wrapMini([
@@ -489,23 +501,20 @@ RenderMsg.prototype.about = function (cb) {
var img = u.linkDest(this.c.image)
// if there is a description, it is likely to be multi-line
var hasDescription = this.c.description != null
- var wrap = hasDescription ? this.wrap : this.wrapMini
- var isSelf = this.c.about === this.msg.value.author
// if this about message gives the thing a name, show its id
var showComputedName = !isSelf && !this.c.name
- wrap.call(this, [
+ this.wrap([
this.c.root ? h('div',
h('small', '> ', this.link1(this.c.root, done()))
) : '',
- isSelf
- ? hasDescription ? 'self-describes' : 'self-identifies'
- : [hasDescription ? 'describes' : 'identifies', ' ',
- !this.c.about ? '?'
+ isSelf ? 'self-describes as ' : [
+ 'describes ',
+ !this.c.about ? ''
: showComputedName ? this.link1(this.c.about, done())
- : h('a', {href: this.toUrl(this.c.about)}, truncate(this.c.about, 10))
- ],
- ' as ',
+ : h('a', {href: this.toUrl(this.c.about)}, truncate(this.c.about, 10)),
+ ' as '
+ ],
this.c.name ? [h('ins', this.c.name), ' '] : '',
this.c.description ? h('div',
{innerHTML: this.render.markdown(this.c.description)}) : '',