git ssb

2+

mixmix / ticktack



Commit 48bebcda44d351b3e77a42a761d37c9ff72ec9f0

Merge branch 'filter'

mix irving committed on 8/17/2017, 3:55:30 AM
Parent: 8d96f1ca26597e7a20fe4f1aa1d5ff63ee880700
Parent: ec2e673495eb4d062dcc4ddda74abbd628303d69

Files changed

app/page/channel.jschanged
app/page/home.jschanged
app/page/channel.jsView
@@ -1,8 +1,9 @@
11 const nest = require('depnest')
22 const { h, computed } = require('mutant')
33 const More = require('hypermore')
44 const morphdom = require('morphdom')
5+const get = require('lodash/get')
56
67 exports.gives = nest('app.page.channel')
78
89 exports.needs = nest({
@@ -22,39 +23,32 @@
2223 }
2324
2425 exports.create = (api) => {
2526 return nest('app.page.channel', function (location) {
26- // location here can expected to be: { page: 'home' }
27+ const { channel } = location
2728 var strings = api.translations.sync.strings()
2829
2930 var container = h('div.container', [])
3031
31- var channelObs = api.state.obs.channel(location.channel)
32+ var channelObs = api.state.obs.channel(channel)
3233
3334 //disable "Show More" button when we are at the last thread.
3435 var disableShowMore = computed([channelObs], threads => !!threads.ended)
3536
3637 var threadsHtmlObs = More(
3738 channelObs,
3839 function render (threads) {
39-
4040 morphdom(container,
4141 // LEGACY: some of these containers could be removed
4242 // but they are here to be compatible with the old MCSS.
4343 h('div.container', [
4444 //private section
4545 h('section.updates -directMessage', [
46- h('div.threads',
47- Object.keys(threads.roots)
48- .map(function (id) {
49- return threads.roots[id]
50- })
51- .sort(function (a, b) {
52- return latestUpdate(b) - latestUpdate(a)
53- })
54- .map(function (thread) {
55- return api.app.html.threadCard(thread)
56- })
46+ h('div.threads', Object.keys(threads.roots)
47+ .map(id => threads.roots[id])
48+ .filter(thread => get(thread, 'value.content.channel') == channel)
49+ .sort((a, b) => latestUpdate(b) - latestUpdate(a))
50+ .map(thread => api.app.html.threadCard(thread))
5751 )
5852 ])
5953 ])
6054 )
@@ -72,5 +66,4 @@
7266 })
7367 }
7468
7569
76-
app/page/home.jsView
@@ -76,8 +76,11 @@
7676 var groupedThreads =
7777 roots(threads.private)
7878 .concat(roots(threads.channels))
7979 .concat(roots(threads.groups))
80+ .filter(function (thread) {
81+ return thread.value.content.recps || thread.value.content.channel
82+ })
8083 .sort(function (a, b) {
8184 return latestUpdate(b) - latestUpdate(a)
8285 })
8386

Built with git-ssb-web