aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-07 10:50:15 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-07 10:50:15 -0500
commitc3809754bf089b801ee3ffa3341beb51a8005ca6 (patch)
tree5bfce58b569f1973d19647f16c1fa743b6874a11 /lib
parentfeaae0282a0607a4a201644b26a7b5c6e5798ebb (diff)
downloadpatchfoo-c3809754bf089b801ee3ffa3341beb51a8005ca6.tar.gz
patchfoo-c3809754bf089b801ee3ffa3341beb51a8005ca6.zip
Push attached blobs on publish
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js4
-rw-r--r--lib/serve.js10
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index 5d8af70..d994d04 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -109,6 +109,10 @@ App.prototype.addBlob = function (cb) {
)
}
+App.prototype.pushBlob = function (id, cb) {
+ this.sbot.blobs.push(id, cb)
+}
+
function getMsgWithValue(sbot, id, cb) {
sbot.get(id, function (err, value) {
if (err) return cb(err)
diff --git a/lib/serve.js b/lib/serve.js
index 7cda95d..88fe389 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -946,7 +946,15 @@ Serve.prototype.composer = function (opts, cb) {
} catch(e) {
return cb(), u.renderError(e)
}
- return self.app.render.publish(content, cb)
+ var done = multicb({pluck: 1, spread: true})
+ toArray(content && content.mentions).forEach(function (mention) {
+ if (mention.link && mention.link[0] === '&' && !isNaN(mention.size))
+ self.app.pushBlob(mention.link, done())
+ })
+ done(function (err) {
+ if (err) return cb(err)
+ self.app.render.publish(content, cb)
+ })
}
}