Commit c0e1e89b2fb18a9f6e4ed67ff823131c49035921
fix sbot.patchwork.latest output to make realtime refresh work
Matt McKegg committed on 6/26/2017, 3:14:55 AMParent: 0a2a19abbd326534732b6aee3ec2351e94dd7a32
Files changed
sbot/roots.js | changed |
sbot/roots.js | ||
---|---|---|
@@ -51,39 +51,28 @@ | ||
51 | 51 | }), |
52 | 52 | |
53 | 53 | // LOOKUP ROOTS |
54 | 54 | pull.asyncMap((item, cb) => { |
55 | + var msg = item.value | |
55 | 56 | var key = item.key[1] |
56 | - if (key === item.value.key) { | |
57 | + if (key === msg.key) { | |
57 | 58 | // already a root |
58 | - cb(null, extend(item.value, { | |
59 | - root: item.value | |
60 | - })) | |
59 | + cb(null, msg) | |
61 | 60 | } |
62 | 61 | getThruCache(key, (_, value) => { |
63 | - cb(null, extend(item.value, { | |
62 | + cb(null, extend(msg, { | |
64 | 63 | root: value |
65 | 64 | })) |
66 | 65 | }) |
67 | 66 | }), |
68 | 67 | |
69 | 68 | // FILTER |
70 | 69 | 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) | |
73 | 74 | } |
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 | - } | |
86 | 75 | }) |
87 | 76 | ) |
88 | 77 | }, |
89 | 78 | read: function ({ids = [ssb.id], reverse, live, old, limit, lt, gt}) { |
Built with git-ssb-web