git ssb

10+

Matt McKegg / patchwork



Commit c0e1e89b2fb18a9f6e4ed67ff823131c49035921

fix sbot.patchwork.latest output to make realtime refresh work

Matt McKegg committed on 6/26/2017, 3:14:55 AM
Parent: 0a2a19abbd326534732b6aee3ec2351e94dd7a32

Files changed

sbot/roots.jschanged
sbot/roots.jsView
@@ -51,39 +51,28 @@
5151 }),
5252
5353 // LOOKUP ROOTS
5454 pull.asyncMap((item, cb) => {
55+ var msg = item.value
5556 var key = item.key[1]
56- if (key === item.value.key) {
57+ if (key === msg.key) {
5758 // already a root
58- cb(null, extend(item.value, {
59- root: item.value
60- }))
59+ cb(null, msg)
6160 }
6261 getThruCache(key, (_, value) => {
63- cb(null, extend(item.value, {
62+ cb(null, extend(msg, {
6463 root: value
6564 }))
6665 })
6766 }),
6867
6968 // FILTER
7069 pull.filter(item => {
71- if (filter && item.root && item.root.value && !getRoot(item.root)) {
72- return filter(ids, item.root)
70+ console.log('filter', item)
71+ var root = item.root || item
72+ if (filter && root && root.value && !getRoot(root)) {
73+ return filter(ids, root)
7374 }
74- }),
75-
76- // MAP
77- pull.map(item => {
78- if (item.root && !item.root.key) {
79- console.log('WRONG:', item)
80- }
81- if (item.root && item.root.key !== item.value.key) {
82- return extend(item.value, { root: item.root })
83- } else {
84- return item.value
85- }
8675 })
8776 )
8877 },
8978 read: function ({ids = [ssb.id], reverse, live, old, limit, lt, gt}) {

Built with git-ssb-web