Commit a4727341e869458648277d26f61c051de3eec9da
drop on message.async.publish override
mix irving committed on 8/15/2017, 5:55:43 AMParent: 62556065fec94029f943b386bebf11f80ac8d829
Files changed
app/html/thread.js | changed |
message/html/compose.js | changed |
message/index.js | changed |
message/async/publish.js | added |
app/html/thread.js | ||
---|---|---|
@@ -14,9 +14,8 @@ | ||
14 | 14 | exports.create = (api) => { |
15 | 15 | return nest('app.html.thread', thread) |
16 | 16 | |
17 | 17 | function thread (root) { |
18 | - console.log('thread root', root) | |
19 | 18 | const myId = api.keys.sync.id() |
20 | 19 | const thread = api.feed.obs.thread(root) |
21 | 20 | const chunkedMessages = buildChunkedMessages(thread.messages) |
22 | 21 |
message/html/compose.js | ||
---|---|---|
@@ -169,14 +169,13 @@ | ||
169 | 169 | if (cb) cb(err) |
170 | 170 | else throw err |
171 | 171 | } |
172 | 172 | |
173 | - debugger | |
174 | - | |
175 | - api.message.async.publish(content, done) | |
173 | + return api.message.async.publish(content, done) | |
176 | 174 | // return api.message.html.confirm(content, done) |
177 | 175 | |
178 | 176 | function done (err, msg) { |
177 | + debugger | |
179 | 178 | publishBtn.disabled = false |
180 | 179 | if (err) throw err |
181 | 180 | else if (msg) textArea.value = '' |
182 | 181 | if (cb) cb(err, msg) |
message/index.js | ||
---|---|---|
@@ -1,5 +1,8 @@ | ||
1 | 1 | module.exports = { |
2 | + async: { | |
3 | + publish: require('./async/publish'), | |
4 | + }, | |
2 | 5 | html: { |
3 | 6 | compose: require('./html/compose') |
4 | 7 | } |
5 | 8 | } |
message/async/publish.js | ||
---|---|---|
@@ -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