Commit f80296e49e5bd1b20ac5c2df3b224d7b61c2d43d
fix up handling of next items, move more feeds to patchcore, bump backlinks
Matt McKegg committed on 6/15/2017, 5:21:18 AMParent: 1bc0f38816aac40575bf6ecc1d8f537c35a519de
Files changed
modules/feed/html/rollup.js | changed |
modules/feed/pull/summary.js | changed |
modules/page/html/render/all.js | changed |
modules/page/html/render/profile.js | changed |
modules/page/html/render/public.js | changed |
package.json | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -45,9 +45,8 @@ | ||
45 | 45 | var filter = opts && opts.filter |
46 | 46 | var bumpFilter = opts && opts.bumpFilter |
47 | 47 | var windowSize = opts && opts.windowSize |
48 | 48 | var waitFor = opts && opts.waitFor || true |
49 | - var getSequence = opts && opts.getSequence | |
50 | 49 | |
51 | 50 | var newSinceRefresh = new Set() |
52 | 51 | var newInSession = new Set() |
53 | 52 | var prioritized = {} |
@@ -151,9 +150,9 @@ | ||
151 | 150 | newSinceRefresh.forEach(x => { |
152 | 151 | prioritized[x] = 2 |
153 | 152 | }) |
154 | 153 | |
155 | - var stream = api.feed.pull.summary(getStream, {windowSize, bumpFilter, prioritized, getSequence}) | |
154 | + var stream = api.feed.pull.summary(getStream, {windowSize, bumpFilter, prioritized}) | |
156 | 155 | loading.set(stream.loading) |
157 | 156 | |
158 | 157 | pull( |
159 | 158 | stream, |
modules/feed/pull/summary.js | ||
---|---|---|
@@ -20,9 +20,8 @@ | ||
20 | 20 | function summary (source, opts, cb) { |
21 | 21 | var bumpFilter = opts && opts.bumpFilter |
22 | 22 | var windowSize = opts && opts.windowSize || 1000 |
23 | 23 | var prioritized = opts && opts.prioritized || {} |
24 | - var getSequence = opts && opts.getSequence | |
25 | 24 | |
26 | 25 | var loading = Value(true) |
27 | 26 | |
28 | 27 | var last = null |
@@ -33,9 +32,9 @@ | ||
33 | 32 | if (!done) { |
34 | 33 | loading.set(true) |
35 | 34 | var next = {reverse: true, limit: windowSize, live: false} |
36 | 35 | if (last) { |
37 | - next.lt = typeof getSequence === 'function' ? getSequence(last) : last.timestamp | |
36 | + next.lt = last | |
38 | 37 | } |
39 | 38 | var deferred = pullDefer.source() |
40 | 39 | pull( |
41 | 40 | source(next), |
modules/page/html/render/all.js | ||
---|---|---|
@@ -1,11 +1,9 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var { h } = require('mutant') |
3 | -var extend = require('xtend') | |
4 | -var pull = require('pull-stream') | |
5 | 3 | |
6 | 4 | exports.needs = nest({ |
7 | - 'sbot.pull.feed': 'first', | |
5 | + 'feed.pull.public': 'first', | |
8 | 6 | 'message.html.compose': 'first', |
9 | 7 | 'message.async.publish': 'first', |
10 | 8 | 'feed.html.rollup': 'first' |
11 | 9 | }) |
@@ -29,9 +27,9 @@ | ||
29 | 27 | ]), |
30 | 28 | api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' }) |
31 | 29 | ] |
32 | 30 | |
33 | - var feedView = api.feed.html.rollup(getFeed, { | |
31 | + var feedView = api.feed.html.rollup(api.feed.pull.public, { | |
34 | 32 | prepend, |
35 | 33 | windowSize: 1000 |
36 | 34 | }) |
37 | 35 | |
@@ -42,20 +40,6 @@ | ||
42 | 40 | result.pendingUpdates = feedView.pendingUpdates |
43 | 41 | result.reload = feedView.reload |
44 | 42 | |
45 | 43 | return result |
46 | - | |
47 | - function getFeed (opts) { | |
48 | - if (opts.lt) { | |
49 | - opts = extend(opts, {lt: parseInt(opts.lt, 10)}) | |
50 | - } | |
51 | - | |
52 | - return pull( | |
53 | - api.sbot.pull.feed(opts), | |
54 | - pull.map((msg) => { | |
55 | - if (msg.sync) return msg | |
56 | - return {key: msg.key, value: msg.value, timestamp: msg.value.timestamp} | |
57 | - }) | |
58 | - ) | |
59 | - } | |
60 | 44 | } |
61 | 45 | } |
modules/page/html/render/profile.js | ||
---|---|---|
@@ -16,9 +16,9 @@ | ||
16 | 16 | 'message.async.publish': 'first', |
17 | 17 | 'message.html.markdown': 'first', |
18 | 18 | 'about.html.image': 'first', |
19 | 19 | 'feed.html.rollup': 'first', |
20 | - 'sbot.pull.userFeed': 'first', | |
20 | + 'feed.pull.profile': 'first', | |
21 | 21 | 'sbot.async.publish': 'first', |
22 | 22 | 'keys.sync.id': 'first', |
23 | 23 | 'sheet.display': 'first', |
24 | 24 | 'profile.obs.rank': 'first', |
@@ -164,11 +164,9 @@ | ||
164 | 164 | h('section', [ namePicker, imagePicker ]) |
165 | 165 | ]) |
166 | 166 | ]) |
167 | 167 | |
168 | - var feedView = api.feed.html.rollup((opts) => { | |
169 | - return api.sbot.pull.userFeed(extend(opts, {id})) | |
170 | - }, { prepend, getSequence: x => x.value.sequence }) | |
168 | + var feedView = api.feed.html.rollup(api.feed.pull.profile(id), { prepend }) | |
171 | 169 | |
172 | 170 | var container = h('div', {className: 'SplitView'}, [ |
173 | 171 | h('div.main', [ |
174 | 172 | feedView |
modules/page/html/render/public.js | ||
---|---|---|
@@ -1,21 +1,15 @@ | ||
1 | 1 | var nest = require('depnest') |
2 | 2 | var { h, send, when, computed, map } = require('mutant') |
3 | -var extend = require('xtend') | |
4 | -var pull = require('pull-stream') | |
5 | 3 | |
6 | 4 | exports.needs = nest({ |
7 | 5 | sbot: { |
8 | - pull: { | |
9 | - log: 'first', | |
10 | - feed: 'first', | |
11 | - userFeed: 'first' | |
12 | - }, | |
13 | 6 | obs: { |
14 | 7 | connectedPeers: 'first', |
15 | 8 | localPeers: 'first' |
16 | 9 | } |
17 | 10 | }, |
11 | + 'feed.pull.public': 'first', | |
18 | 12 | 'about.html.image': 'first', |
19 | 13 | 'about.obs.name': 'first', |
20 | 14 | 'invite.sheet': 'first', |
21 | 15 | |
@@ -56,9 +50,9 @@ | ||
56 | 50 | var prepend = [ |
57 | 51 | api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' }) |
58 | 52 | ] |
59 | 53 | |
60 | - var feedView = api.feed.html.rollup(getFeed, { | |
54 | + var feedView = api.feed.html.rollup(api.feed.pull.public, { | |
61 | 55 | prepend, |
62 | 56 | waitFor: computed([ |
63 | 57 | following.sync, |
64 | 58 | subscribedChannels.sync |
@@ -210,26 +204,8 @@ | ||
210 | 204 | ]) |
211 | 205 | ] |
212 | 206 | } |
213 | 207 | |
214 | - function getFeed (opts) { | |
215 | - if (opts.lt) { | |
216 | - opts = extend(opts, {lt: parseInt(opts.lt, 10)}) | |
217 | - } | |
218 | - | |
219 | - return pull( | |
220 | - api.sbot.pull.feed(opts), | |
221 | - pull.map((msg) => { | |
222 | - if (msg.sync) return msg | |
223 | - return {key: msg.key, value: msg.value, timestamp: msg.value.timestamp} | |
224 | - }) | |
225 | - ) | |
226 | - } | |
227 | - | |
228 | - function getFirstMessage (feedId, cb) { | |
229 | - api.sbot.pull.userFeed({id: feedId, gte: 0, limit: 1})(null, cb) | |
230 | - } | |
231 | - | |
232 | 208 | function subscribe (id) { |
233 | 209 | api.message.async.publish({ |
234 | 210 | type: 'channel', |
235 | 211 | channel: id, |
package.json | ||
---|---|---|
@@ -28,9 +28,9 @@ | ||
28 | 28 | "micro-css": "^2.0.0", |
29 | 29 | "mutant": "^3.20.2", |
30 | 30 | "mutant-pull-reduce": "^1.1.0", |
31 | 31 | "obv": "0.0.1", |
32 | - "patchcore": "~1.1.1", | |
32 | + "patchcore": "~1.2.0", | |
33 | 33 | "patchwork-gatherings": "^1.0.2", |
34 | 34 | "pull-abortable": "^4.1.0", |
35 | 35 | "pull-defer": "^0.2.2", |
36 | 36 | "pull-file": "~1.0.0", |
@@ -45,9 +45,9 @@ | ||
45 | 45 | "scuttlebot": "~10.0.5", |
46 | 46 | "sorted-array-functions": "~1.0.0", |
47 | 47 | "ssb-about": "0.1.0", |
48 | 48 | "ssb-avatar": "^0.2.0", |
49 | - "ssb-backlinks": "0.2.0", | |
49 | + "ssb-backlinks": "~0.3.0", | |
50 | 50 | "ssb-blobs": "~1.1.0", |
51 | 51 | "ssb-contacts": "0.0.2", |
52 | 52 | "ssb-friends": "^2.0.3", |
53 | 53 | "ssb-keys": "~7.0.9", |
Built with git-ssb-web