aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-30 09:56:28 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-05-30 10:39:37 -1000
commitcb3aa7e2332964780e817185c05d6f98870496d7 (patch)
tree8f342c7186db0d6bda99d9940d594fcb986d25a7
parentc8ba67e6dd520dbd3671256249feb67be220938d (diff)
downloadpatchfoo-cb3aa7e2332964780e817185c05d6f98870496d7.tar.gz
patchfoo-cb3aa7e2332964780e817185c05d6f98870496d7.zip
Include blob size even when just mentioning
-rw-r--r--lib/serve.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 1d8d8af..6aed742 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -2043,6 +2043,7 @@ Serve.prototype.composer = function (opts, cb) {
done(cb)
function prepareContent(cb) {
+ var done = multicb({pluck: 1})
content = {
type: 'post',
text: String(data.text).replace(/\r\n/g, '\n'),
@@ -2067,6 +2068,13 @@ Serve.prototype.composer = function (opts, cb) {
if (id) mention.link = id
else return false
}
+ if (mention.link && mention.link[0] === '&' && mention.size == null) {
+ var linkCb = done()
+ self.app.sbot.blobs.size(mention.link, function (err, size) {
+ if (!err && size != null) mention.size = size
+ linkCb()
+ })
+ }
return true
})
if (mentions.length) content.mentions = mentions
@@ -2087,7 +2095,10 @@ Serve.prototype.composer = function (opts, cb) {
content.branch = u.fromArray(opts.branches) || undefined
}
if (channel) content.channel = data.channel
- cb(null, content)
+
+ done(function (err) {
+ cb(err, content)
+ })
}
function preview(raw, cb) {