git ssb

2+

mixmix / ticktack



Commit 60479658b26b297158dd59938d021562a5b447ec

remove dead code

Dominic Tarr committed on 8/14/2017, 1:13:11 PM
Parent: 673c7a2d4beb3d140d4a72dc921e63e7f985f873

Files changed

app/page/channel.jschanged
app/page/channel.jsView
@@ -16,23 +16,20 @@
1616
1717 exports.needs = nest({
1818 'app.html.nav': 'first',
1919 'history.sync.push': 'first',
20- 'keys.sync.id': 'first',
2120 'translations.sync.strings': 'first',
22- 'state.obs.threads': 'first',
2321 'app.html.threadCard': 'first',
24- 'feed.pull.channel': 'first'
22+ 'state.obs.channel': 'first',
2523 })
2624
27-function toRecpGroup(msg) {
28- //cannocialize
29- return Array.isArray(msg.value.content.repcs) &&
30- msg.value.content.recps.map(function (e) {
31- return (isString(e) ? e : e.link)
32- }).sort().map(function (id) {
33- return id.substring(0, 10)
34- }).join(',')
25+function latestUpdate(thread) {
26+ var m = thread.timestamp
27+ if(!thread.replies) return m
28+
29+ for(var i = 0; i < thread.replies.length; i++)
30+ m = Math.max(thread.replies[i].timestamp, m)
31+ return m
3532 }
3633
3734 exports.create = (api) => {
3835 return nest('app.page.channel', function (location) {
@@ -40,22 +37,10 @@
4037 var strings = api.translations.sync.strings()
4138
4239 var container = h('div.container', [])
4340
44- function filterForThread (thread) {
45- if(thread.value.private)
46- return {private: toRecpGroup(thread)}
47- else if(thread.value.content.channel)
48- return {channel: thread.value.content.channel}
49- }
41+ var channelObs = api.state.obs.channel(location.channel)
5042
51- var createChannelStream = api.feed.pull.channel(location.channel)
52-
53- var channelObs = PullObv(
54- threadReduce,
55- createChannelStream({reverse: true, limit: 1000})
56- )
57-
5843 //disable "Show More" button when we are at the last thread.
5944 var disableShowMore = Computed([channelObs], function (threads) {
6045 return !!threads.ended
6146 })
@@ -63,42 +48,29 @@
6348 var threadsHtmlObs = More(
6449 channelObs,
6550 function render (threads) {
6651
67- var sorted = Object.keys(threads.roots)
68- .map(function (id) {
69- return threads.roots[id]
70- })
71- .sort(function (a, b) {
72- return latestUpdate(b) - latestUpdate(a)
73- })
74-
75- function latestUpdate(thread) {
76- var m = thread.timestamp
77- if(!thread.replies) return m
78-
79- for(var i = 0; i < thread.replies.length; i++)
80- m = Math.max(thread.replies[i].timestamp, m)
81- return m
82- }
83-
8452 morphdom(container,
8553 // LEGACY: some of these containers could be removed
8654 // but they are here to be compatible with the old MCSS.
8755 h('div.container', [
8856 //private section
8957 h('section.updates -directMessage', [
90- h('div.threads',
91- sorted
92- .map(function (thread) {
93- var el = api.app.html
94- .threadCard(thread, opts)
95- return el
58+ h('div.threads',
59+ Object.keys(threads.roots)
60+ .map(function (id) {
61+ return threads.roots[id]
9662 })
63+ .sort(function (a, b) {
64+ return latestUpdate(b) - latestUpdate(a)
65+ })
66+ .map(function (thread) {
67+ return api.app.html.threadCard(thread, opts)
68+ })
9769 )
98- ]),
99- ])
100- )
70+ ])
71+ ])
72+ )
10173 return container
10274 }
10375 )
10476
@@ -115,4 +87,6 @@
11587 }
11688
11789
11890
91+
92+

Built with git-ssb-web