Commit 1974af6446a393858246daea9600c9d87901b116
Live update on new comment
Anders Rune Jensen committed on 1/1/2018, 4:46:27 PMParent: c121c4c0d918bfef97e879b331611c5a0a605fa7
Files changed
book/async/get.js | changed |
book/html/layout/detail.js | changed |
book/async/get.js | ||
---|---|---|
@@ -50,24 +50,26 @@ | ||
50 | 50 … | pull.values(Object.values(book.subjective)), |
51 | 51 … | pull.drain(subj => { |
52 | 52 … | if (subj.key) { |
53 | 53 … | pull( |
54 | - api.sbot.pull.links({ dest: subj.key }), | |
54 … | + api.sbot.pull.links({ dest: subj.key, live: true }), | |
55 | 55 … | pull.filter(data => data.key), |
56 | 56 … | pull.asyncMap((data, cb) => { |
57 | 57 … | api.sbot.async.get(data.key, (err, msg) => { |
58 | 58 … | msg.key = data.key |
59 | 59 … | cb(err, msg) |
60 | 60 … | }) |
61 | 61 … | }), |
62 | - sort((a, b) => a.timestamp - b.timestamp), | |
62 … | + //sort((a, b) => a.timestamp - b.timestamp), | |
63 | 63 … | pull.drain(msg => { |
64 | 64 … | if (msg.content.type !== "post") return |
65 | 65 … | |
66 | 66 … | // FIXME: links is buggy and returns the same message twice |
67 | - if (!subj.comments.some(c => c.content.text == msg.content.text)) | |
67 … | + if (!subj.comments.some(c => c.content.text == msg.content.text)) { | |
68 | 68 … | subj.comments.push(msg) |
69 | - }, () => cb(book)) | |
69 … | + cb(book) | |
70 … | + } | |
71 … | + }) | |
70 | 72 … | ) |
71 | 73 … | } |
72 | 74 … | }, () => cb(book)) |
73 | 75 … | ) |
book/html/layout/detail.js | |||
---|---|---|---|
@@ -177,9 +177,11 @@ | |||
177 | 177 … | when(subjective.key, | |
178 | 178 … | h('button', { 'ev-click': () => { | |
179 | 179 … | obs.addCommentToSubjective(subjective.key(), | |
180 | 180 … | lastCommentId || subjective.key(), | |
181 | - subjectiveComment()) } | ||
181 … | + subjectiveComment(), () => { | ||
182 … | + textArea.value = '' | ||
183 … | + }) } | ||
182 | 184 … | }, 'Add comment')) | |
183 | 185 … | ]), | |
184 | 186 … | h('section.actions', | |
185 | 187 … | when(isMe, [ |
Built with git-ssb-web