git ssb

10+

Matt McKegg / patchwork



Tree: f2fe1479a8bee020c26316b0de9aa604955194fa

Files: f2fe1479a8bee020c26316b0de9aa604955194fa / modules / message / async / publish.js

623 bytesRaw
1var nest = require('depnest')
2
3exports.needs = nest({
4 'message.sheet.preview': 'first',
5 'sbot.async.publish': 'first',
6 'keys.sync.id': 'first'
7})
8
9exports.gives = nest('message.async.publish')
10
11exports.create = function (api) {
12 return nest('message.async.publish', function (content, cb) {
13 api.message.sheet.preview({value: {
14 content,
15 private: !!content.recps,
16 author: api.keys.sync.id()
17 }}, (err, confirmed) => {
18 if (err) throw err
19 if (confirmed) {
20 api.sbot.async.publish(content, cb)
21 } else {
22 cb && cb(null, false)
23 }
24 })
25 return true
26 })
27}
28

Built with git-ssb-web