From 99f1cd583790f5f31898b12df64adde53b27145e Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 21 May 2018 07:38:44 -0400 Subject: Render share messages --- lib/render-msg.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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) + }) +} -- cgit v1.2.3