Commit 51182f00266ed98dce8a438372451c49940eaa36
fix userShow scroller (was using wrong index property)
mix irving committed on 12/8/2017, 5:54:57 AMParent: 9b70108d00646124112662ec83dd9733d7afca7d
Files changed
app/html/scroller.js | changed |
app/page/userShow.js | changed |
app/html/scroller.js | ||
---|---|---|
@@ -16,17 +16,18 @@ | ||
16 | 16 | function createScroller (opts = {}) { |
17 | 17 | const { |
18 | 18 | stream, |
19 | 19 | filter = () => pull.filter((msg) => true), |
20 | + indexProperty = ['value', 'timestamp'] | |
20 | 21 | } = opts |
21 | 22 | |
22 | 23 | const streamToTop = pull( |
23 | - next(stream, {old: false, limit: 100, property: ['value', 'timestamp']}), | |
24 | + next(stream, {old: false, limit: 100, property: indexProperty }), | |
24 | 25 | filter() // is a pull-stream through |
25 | 26 | ) |
26 | 27 | |
27 | 28 | const streamToBottom = pull( |
28 | - next(stream, {reverse: true, limit: 100, live: false, property: ['value', 'timestamp']}), | |
29 | + next(stream, {reverse: true, limit: 100, live: false, property: indexProperty }), | |
29 | 30 | filter() |
30 | 31 | ) |
31 | 32 | |
32 | 33 | return Scroller(Object.assign({}, opts, { streamToTop, streamToBottom })) |
app/page/userShow.js | ||
---|---|---|
@@ -19,8 +19,9 @@ | ||
19 | 19 | 'feed.pull.profile': 'first', |
20 | 20 | 'feed.pull.rollup': 'first', |
21 | 21 | 'message.html.markdown': 'first', |
22 | 22 | 'keys.sync.id': 'first', |
23 | + 'sbot.pull.userFeed': 'first', | |
23 | 24 | 'translations.sync.strings': 'first', |
24 | 25 | 'unread.sync.isUnread': 'first' |
25 | 26 | }) |
26 | 27 | |
@@ -74,19 +75,29 @@ | ||
74 | 75 | : '', |
75 | 76 | ]), |
76 | 77 | ] |
77 | 78 | |
79 | + const store = MutantArray() | |
80 | + // store(console.log) | |
81 | + | |
78 | 82 | return h('Page -userShow', [ |
79 | 83 | api.app.html.context(location), |
80 | 84 | api.app.html.scroller({ |
81 | 85 | classList: ['content'], |
82 | 86 | prepend, |
83 | - stream: api.feed.pull.profile(feed), | |
87 | + // stream: api.feed.pull.profile(feed), | |
88 | + stream: opts => api.sbot.pull.userFeed(Object.assign({}, { id: feed }, opts)), | |
89 | + indexProperty: ['value', 'sequence'], | |
84 | 90 | filter: () => pull( |
91 | + // pull.filter(msg => get(msg, 'value.author') === feed), | |
92 | + pull.filter(msg => typeof msg.value.content !== 'string'), | |
85 | 93 | pull.filter(msg => get(msg, 'value.content.root') === undefined), |
86 | 94 | pull.filter(msg => BLOG_TYPES.includes(get(msg, 'value.content.type'))) |
87 | 95 | ), |
88 | - render: api.app.html.blogCard | |
96 | + render: blog => { | |
97 | + return api.app.html.blogCard(blog) | |
98 | + }, | |
99 | + store | |
89 | 100 | }) |
90 | 101 | ]) |
91 | 102 | } |
92 | 103 | } |
Built with git-ssb-web