git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

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 AM
Parent: 1bc0f38816aac40575bf6ecc1d8f537c35a519de

Files changed

modules/feed/html/rollup.jschanged
modules/feed/pull/summary.jschanged
modules/page/html/render/all.jschanged
modules/page/html/render/profile.jschanged
modules/page/html/render/public.jschanged
package.jsonchanged
modules/feed/html/rollup.jsView
@@ -45,9 +45,8 @@
4545 var filter = opts && opts.filter
4646 var bumpFilter = opts && opts.bumpFilter
4747 var windowSize = opts && opts.windowSize
4848 var waitFor = opts && opts.waitFor || true
49- var getSequence = opts && opts.getSequence
5049
5150 var newSinceRefresh = new Set()
5251 var newInSession = new Set()
5352 var prioritized = {}
@@ -151,9 +150,9 @@
151150 newSinceRefresh.forEach(x => {
152151 prioritized[x] = 2
153152 })
154153
155- var stream = api.feed.pull.summary(getStream, {windowSize, bumpFilter, prioritized, getSequence})
154+ var stream = api.feed.pull.summary(getStream, {windowSize, bumpFilter, prioritized})
156155 loading.set(stream.loading)
157156
158157 pull(
159158 stream,
modules/feed/pull/summary.jsView
@@ -20,9 +20,8 @@
2020 function summary (source, opts, cb) {
2121 var bumpFilter = opts && opts.bumpFilter
2222 var windowSize = opts && opts.windowSize || 1000
2323 var prioritized = opts && opts.prioritized || {}
24- var getSequence = opts && opts.getSequence
2524
2625 var loading = Value(true)
2726
2827 var last = null
@@ -33,9 +32,9 @@
3332 if (!done) {
3433 loading.set(true)
3534 var next = {reverse: true, limit: windowSize, live: false}
3635 if (last) {
37- next.lt = typeof getSequence === 'function' ? getSequence(last) : last.timestamp
36+ next.lt = last
3837 }
3938 var deferred = pullDefer.source()
4039 pull(
4140 source(next),
modules/page/html/render/all.jsView
@@ -1,11 +1,9 @@
11 var nest = require('depnest')
22 var { h } = require('mutant')
3-var extend = require('xtend')
4-var pull = require('pull-stream')
53
64 exports.needs = nest({
7- 'sbot.pull.feed': 'first',
5+ 'feed.pull.public': 'first',
86 'message.html.compose': 'first',
97 'message.async.publish': 'first',
108 'feed.html.rollup': 'first'
119 })
@@ -29,9 +27,9 @@
2927 ]),
3028 api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' })
3129 ]
3230
33- var feedView = api.feed.html.rollup(getFeed, {
31+ var feedView = api.feed.html.rollup(api.feed.pull.public, {
3432 prepend,
3533 windowSize: 1000
3634 })
3735
@@ -42,20 +40,6 @@
4240 result.pendingUpdates = feedView.pendingUpdates
4341 result.reload = feedView.reload
4442
4543 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- }
6044 }
6145 }
modules/page/html/render/profile.jsView
@@ -16,9 +16,9 @@
1616 'message.async.publish': 'first',
1717 'message.html.markdown': 'first',
1818 'about.html.image': 'first',
1919 'feed.html.rollup': 'first',
20- 'sbot.pull.userFeed': 'first',
20+ 'feed.pull.profile': 'first',
2121 'sbot.async.publish': 'first',
2222 'keys.sync.id': 'first',
2323 'sheet.display': 'first',
2424 'profile.obs.rank': 'first',
@@ -164,11 +164,9 @@
164164 h('section', [ namePicker, imagePicker ])
165165 ])
166166 ])
167167
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 })
171169
172170 var container = h('div', {className: 'SplitView'}, [
173171 h('div.main', [
174172 feedView
modules/page/html/render/public.jsView
@@ -1,21 +1,15 @@
11 var nest = require('depnest')
22 var { h, send, when, computed, map } = require('mutant')
3-var extend = require('xtend')
4-var pull = require('pull-stream')
53
64 exports.needs = nest({
75 sbot: {
8- pull: {
9- log: 'first',
10- feed: 'first',
11- userFeed: 'first'
12- },
136 obs: {
147 connectedPeers: 'first',
158 localPeers: 'first'
169 }
1710 },
11+ 'feed.pull.public': 'first',
1812 'about.html.image': 'first',
1913 'about.obs.name': 'first',
2014 'invite.sheet': 'first',
2115
@@ -56,9 +50,9 @@
5650 var prepend = [
5751 api.message.html.compose({ meta: { type: 'post' }, placeholder: 'Write a public message' })
5852 ]
5953
60- var feedView = api.feed.html.rollup(getFeed, {
54+ var feedView = api.feed.html.rollup(api.feed.pull.public, {
6155 prepend,
6256 waitFor: computed([
6357 following.sync,
6458 subscribedChannels.sync
@@ -210,26 +204,8 @@
210204 ])
211205 ]
212206 }
213207
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-
232208 function subscribe (id) {
233209 api.message.async.publish({
234210 type: 'channel',
235211 channel: id,
package.jsonView
@@ -28,9 +28,9 @@
2828 "micro-css": "^2.0.0",
2929 "mutant": "^3.20.2",
3030 "mutant-pull-reduce": "^1.1.0",
3131 "obv": "0.0.1",
32- "patchcore": "~1.1.1",
32+ "patchcore": "~1.2.0",
3333 "patchwork-gatherings": "^1.0.2",
3434 "pull-abortable": "^4.1.0",
3535 "pull-defer": "^0.2.2",
3636 "pull-file": "~1.0.0",
@@ -45,9 +45,9 @@
4545 "scuttlebot": "~10.0.5",
4646 "sorted-array-functions": "~1.0.0",
4747 "ssb-about": "0.1.0",
4848 "ssb-avatar": "^0.2.0",
49- "ssb-backlinks": "0.2.0",
49+ "ssb-backlinks": "~0.3.0",
5050 "ssb-blobs": "~1.1.0",
5151 "ssb-contacts": "0.0.2",
5252 "ssb-friends": "^2.0.3",
5353 "ssb-keys": "~7.0.9",

Built with git-ssb-web