git ssb

3+

arj / patchbook



Commit 1974af6446a393858246daea9600c9d87901b116

Live update on new comment

Anders Rune Jensen committed on 1/1/2018, 4:46:27 PM
Parent: c121c4c0d918bfef97e879b331611c5a0a605fa7

Files changed

book/async/get.jschanged
book/html/layout/detail.jschanged
book/async/get.jsView
@@ -50,24 +50,26 @@
5050 pull.values(Object.values(book.subjective)),
5151 pull.drain(subj => {
5252 if (subj.key) {
5353 pull(
54- api.sbot.pull.links({ dest: subj.key }),
54 + api.sbot.pull.links({ dest: subj.key, live: true }),
5555 pull.filter(data => data.key),
5656 pull.asyncMap((data, cb) => {
5757 api.sbot.async.get(data.key, (err, msg) => {
5858 msg.key = data.key
5959 cb(err, msg)
6060 })
6161 }),
62- sort((a, b) => a.timestamp - b.timestamp),
62 + //sort((a, b) => a.timestamp - b.timestamp),
6363 pull.drain(msg => {
6464 if (msg.content.type !== "post") return
6565
6666 // 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)) {
6868 subj.comments.push(msg)
69- }, () => cb(book))
69 + cb(book)
70 + }
71 + })
7072 )
7173 }
7274 }, () => cb(book))
7375 )
book/html/layout/detail.jsView
@@ -177,9 +177,11 @@
177177 when(subjective.key,
178178 h('button', { 'ev-click': () => {
179179 obs.addCommentToSubjective(subjective.key(),
180180 lastCommentId || subjective.key(),
181- subjectiveComment()) }
181 + subjectiveComment(), () => {
182 + textArea.value = ''
183 + }) }
182184 }, 'Add comment'))
183185 ]),
184186 h('section.actions',
185187 when(isMe, [

Built with git-ssb-web