diff options
author | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-05-09 11:09:09 -0400 |
---|---|---|
committer | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-05-09 11:09:09 -0400 |
commit | 912a387ae7c8732d21026c16c80eb220526dd6fd (patch) | |
tree | 03323b751b25017b299b3df043b31d61c6badf83 | |
parent | a61279f373c90d3fdfcab9b1452ea274699b2289 (diff) | |
download | patchfoo-912a387ae7c8732d21026c16c80eb220526dd6fd.tar.gz patchfoo-912a387ae7c8732d21026c16c80eb220526dd6fd.zip |
Render feedless posts compactly
-rw-r--r-- | lib/render-msg.js | 11 | ||||
-rw-r--r-- | lib/serve.js | 4 |
2 files changed, 13 insertions, 2 deletions
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()) diff --git a/lib/serve.js b/lib/serve.js index 7d686a4..71426c3 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -4622,7 +4622,7 @@ Serve.prototype.composer = function (opts, cb) { function closeIssueCheckbox(cb) { var container = h('div') - if (opts.root) self.getMsgDecryptedMaybeOoo(opts.root, function (err, rootMsg) { + if (opts.root && opts.root[0] === '%') self.getMsgDecryptedMaybeOoo(opts.root, function (err, rootMsg) { if (err) return console.trace(err), cb(null) var rootC = rootMsg && rootMsg.value.content && rootMsg.value.content if (!rootC) return cb(null) @@ -4642,7 +4642,7 @@ Serve.prototype.composer = function (opts, cb) { function mentionAttendeesCheckbox(cb) { var container = h('div') - if (opts.root) self.getMsgDecryptedMaybeOoo(opts.root, function (err, rootMsg) { + if (opts.root && opts.root[0] === '%') self.getMsgDecryptedMaybeOoo(opts.root, function (err, rootMsg) { if (err) return console.trace(err), cb(null) var rootC = rootMsg && rootMsg.value.content && rootMsg.value.content if (!rootC) return cb(null) |