From 912a387ae7c8732d21026c16c80eb220526dd6fd Mon Sep 17 00:00:00 2001 From: cel Date: Sat, 9 May 2020 11:09:09 -0400 Subject: Render feedless posts compactly --- lib/render-msg.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/render-msg.js') diff --git a/lib/render-msg.js b/lib/render-msg.js index d01523e..a1b62e4 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -425,6 +425,17 @@ RenderMsg.prototype.markdownSource = function (text, mentions) { RenderMsg.prototype.post = function (cb) { var self = this + var isFeedless = self.c.root && self.c.root[0] === '@' && !self.c.branch + && typeof self.c.text === 'string' && self.c.text.length <= 139 + if (isFeedless) { + return self.link(self.c.root, function (err, rootLink) { + if (err) return self.wrap(u.renderError(err), cb) + self.wrapMini(h('span', [ + rootLink, ' ', + h('span', {innerHTML: u.unwrapP(self.markdown())}) + ]), cb) + }) + } var done = multicb({pluck: 1, spread: true}) if (self.c.root === self.c.branch) done()() else self.link(self.c.root, done()) -- cgit v1.2.3