aboutsummaryrefslogtreecommitdiff
path: root/lib/render-msg.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-05-21 07:38:44 -0400
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-05-21 07:38:44 -0400
commit99f1cd583790f5f31898b12df64adde53b27145e (patch)
treeb7a5d0159b2eb9259ea5a28cf29a3216cce0508b /lib/render-msg.js
parent3062145ff1e210f52eb0c2750a7eacd4f7d14ce8 (diff)
downloadpatchfoo-99f1cd583790f5f31898b12df64adde53b27145e.tar.gz
patchfoo-99f1cd583790f5f31898b12df64adde53b27145e.zip
Render share messages
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r--lib/render-msg.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js
index 50dc6de..91e7386 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -298,6 +298,7 @@ RenderMsg.prototype.message = function (cb) {
case 'poll': return this.poll(cb)
case 'position': if (this.c.version === 'v1') return this.pollPosition(cb)
case 'scat_message': return this.scat(cb)
+ case 'share': return this.share(cb)
default: return this.object(cb)
}
}
@@ -1798,3 +1799,25 @@ RenderMsg.prototype.scat = function (cb) {
h('q', String(this.c.text))
], cb)
}
+
+RenderMsg.prototype.share = function (cb) {
+ var self = this
+ var share = self.c.share || {}
+ self.link(share.link, function (err, link) {
+ self.wrapMini([
+ 'shares ',
+ share.content === 'blog' ? 'blog '
+ : share.content ? [h('code', String(share.content)), ' ']
+ : '',
+ link || String(share.link),
+ share.url ? [
+ ' at ',
+ h('small', h('a', {href: self.toUrl(share.url)}, share.url))
+ ] : '',
+ share.text ? [
+ ': ',
+ h('q', String(share.text))
+ ] : ''
+ ], cb)
+ })
+}