git ssb

2+

mixmix / ticktack



Commit a4727341e869458648277d26f61c051de3eec9da

drop on message.async.publish override

mix irving committed on 8/15/2017, 5:55:43 AM
Parent: 62556065fec94029f943b386bebf11f80ac8d829

Files changed

app/html/thread.jschanged
message/html/compose.jschanged
message/index.jschanged
message/async/publish.jsadded
app/html/thread.jsView
@@ -14,9 +14,8 @@
1414 exports.create = (api) => {
1515 return nest('app.html.thread', thread)
1616
1717 function thread (root) {
18- console.log('thread root', root)
1918 const myId = api.keys.sync.id()
2019 const thread = api.feed.obs.thread(root)
2120 const chunkedMessages = buildChunkedMessages(thread.messages)
2221
message/html/compose.jsView
@@ -169,14 +169,13 @@
169169 if (cb) cb(err)
170170 else throw err
171171 }
172172
173- debugger
174-
175- api.message.async.publish(content, done)
173+ return api.message.async.publish(content, done)
176174 // return api.message.html.confirm(content, done)
177175
178176 function done (err, msg) {
177+ debugger
179178 publishBtn.disabled = false
180179 if (err) throw err
181180 else if (msg) textArea.value = ''
182181 if (cb) cb(err, msg)
message/index.jsView
@@ -1,5 +1,8 @@
11 module.exports = {
2+ async: {
3+ publish: require('./async/publish'),
4+ },
25 html: {
36 compose: require('./html/compose')
47 }
58 }
message/async/publish.jsView
@@ -1,0 +1,21 @@
1+const h = require('mutant/h')
2+const nest = require('depnest')
3+
4+exports.needs = nest({
5+ 'sbot.async.publish': 'first'
6+})
7+
8+exports.gives = nest('message.async.publish')
9+
10+exports.create = function (api) {
11+ return nest('message.async.publish', (content, cb) => {
12+ api.sbot.async.publish(content, (err, data) => {
13+ console.log('publish:', err, data)
14+
15+ cb(err, data)
16+ })
17+
18+ return true
19+ })
20+}
21+

Built with git-ssb-web