git ssb

2+

mixmix / ticktack



Commit 1be1564d9a05ca401019091795be8867a1aa1111

show user blogs and posts on their userShow page

mix irving committed on 10/17/2017, 12:10:18 AM
Parent: 23c8bbd3f9f930a0a1fb464a50c47d9218e80173

Files changed

app/page/userShow.jschanged
app/page/userShow.mcsschanged
app/page/userShow.jsView
@@ -12,12 +12,10 @@
1212 'app.html.blogCard': 'first',
1313 'contact.async.follow': 'first',
1414 'contact.async.unfollow': 'first',
1515 'contact.obs.followers': 'first',
16- 'feed.pull.private': 'first',
17- 'feed.pull.rollup': 'first',
16+ 'sbot.pull.userFeed': 'first',
1817 'keys.sync.id': 'first',
19- 'state.obs.threads': 'first',
2018 'translations.sync.strings': 'first',
2119 })
2220
2321 exports.create = (api) => {
@@ -57,23 +55,17 @@
5755 const Link = api.app.html.link
5856 const userEditButton = Link({ page: 'userEdit', feed }, h('i.fa.fa-pencil'))
5957 const directMessageButton = Link({ page: 'threadNew', feed }, h('Button', strings.userShow.action.directMessage))
6058
61- const threads = MutantArray()
59+ const BLOG_TYPES = ['blog', 'post']
60+ const blogs = MutantArray()
6261 pull(
6362 // next(api.feed.pull.private, {reverse: true, limit: 100, live: false}, ['value', 'timestamp']),
6463 // api.feed.pull.private({reverse: true, limit: 100, live: false}),
65- api.feed.pull.private({reverse: true, live: false}),
66- pull.filter(msg => {
67- const recps = get(msg, 'value.content.recps')
68- if (!recps) return
69-
70- return recps
71- .map(r => typeof r === 'object' ? r.link : r)
72- .includes(feed)
73- }),
74- api.feed.pull.rollup(),
75- pull.drain(threads.push)
64+ api.sbot.pull.userFeed({id: feed, reverse: true, live: false}),
65+ pull.filter(msg => BLOG_TYPES.includes(get(msg, 'value.content.type'))),
66+ pull.filter(msg => get(msg, 'value.content.root') === undefined),
67+ pull.drain(blogs.push)
7668 // Scroller(content, scrollerContent, render, false, false)
7769 )
7870
7971 return h('Page -userShow', {title: name}, [
@@ -92,9 +84,9 @@
9284 h('div.directMessage', directMessageButton)
9385 ])
9486 : '',
9587 ]),
96- h('section.blogs', map(threads, api.app.html.blogCard))
88+ h('section.blogs', map(blogs, api.app.html.blogCard))
9789 ])
9890 ])
9991 }
10092 }
app/page/userShow.mcssView
@@ -31,10 +31,11 @@
3131 }
3232 }
3333
3434 section.blogs {
35+ div.BlogCard {
36+ margin-bottom: .5rem
37+ }
3538 }
36-
37- div.threads {}
3839 }
3940 }
4041

Built with git-ssb-web