diff options
author | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-03-25 20:37:03 -0400 |
---|---|---|
committer | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-03-28 13:55:47 -0400 |
commit | 06b31831c1f92318394eff0265606d8ef86ca75d (patch) | |
tree | 799ca4c1516363b4d594394ff57294c83bf6990c /lib | |
parent | 8044862dc44f6baa725154c762e69b2dfc8c6f95 (diff) | |
download | patchfoo-06b31831c1f92318394eff0265606d8ef86ca75d.tar.gz patchfoo-06b31831c1f92318394eff0265606d8ef86ca75d.zip |
gathering: list initial mentions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render-msg.js | 17 | ||||
-rw-r--r-- | lib/render.js | 8 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 991204d..cd82713 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -1363,7 +1363,22 @@ RenderMsg.prototype.mutualAccount = function (cb) { } RenderMsg.prototype.gathering = function (cb) { - this.wrapMini('gathering', cb) + var self = this + var id = self.msg.key + var idEl = id ? h('code', h('small', id)) : 'gathering' + if (self.c.mentions) { + self.render.prepareLinks(self.c.mentions, function (err, mentions) { + if (err) return cb(err) + self.wrap(mentions.map(function (link, i) { + return [ + ' ', + h('a', {href: self.toUrl(link.link)}, linkName(link)) + ] + }), cb) + }) + return + } + self.wrapMini(idEl, cb) } RenderMsg.prototype.micro = function (cb) { diff --git a/lib/render.js b/lib/render.js index 36f23ba..a39ba73 100644 --- a/lib/render.js +++ b/lib/render.js @@ -480,6 +480,14 @@ Render.prototype.getName = function (id, cb) { Render.prototype.getNameLink = function (id, opts, cb) { if (!cb && typeof opts === 'function') cb = opts, opts = null + if (typeof id === 'object' && id !== null && typeof id.link === 'string') { + var link = id + id = link.link + if (typeof link.name === 'string') { + return cb(null, h('a', {href: self.toUrl(id)}, + u.truncate(link.name, length))) + } + } var length = opts && opts.length || Infinity var self = this self.getName(id, function (err, name) { |