Commit 60479658b26b297158dd59938d021562a5b447ec
remove dead code
Dominic Tarr committed on 8/14/2017, 1:13:11 PMParent: 673c7a2d4beb3d140d4a72dc921e63e7f985f873
Files changed
app/page/channel.js | changed |
app/page/channel.js | ||
---|---|---|
@@ -16,23 +16,20 @@ | ||
16 | 16 | |
17 | 17 | exports.needs = nest({ |
18 | 18 | 'app.html.nav': 'first', |
19 | 19 | 'history.sync.push': 'first', |
20 | - 'keys.sync.id': 'first', | |
21 | 20 | 'translations.sync.strings': 'first', |
22 | - 'state.obs.threads': 'first', | |
23 | 21 | 'app.html.threadCard': 'first', |
24 | - 'feed.pull.channel': 'first' | |
22 | + 'state.obs.channel': 'first', | |
25 | 23 | }) |
26 | 24 | |
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 | |
35 | 32 | } |
36 | 33 | |
37 | 34 | exports.create = (api) => { |
38 | 35 | return nest('app.page.channel', function (location) { |
@@ -40,22 +37,10 @@ | ||
40 | 37 | var strings = api.translations.sync.strings() |
41 | 38 | |
42 | 39 | var container = h('div.container', []) |
43 | 40 | |
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) | |
50 | 42 | |
51 | - var createChannelStream = api.feed.pull.channel(location.channel) | |
52 | - | |
53 | - var channelObs = PullObv( | |
54 | - threadReduce, | |
55 | - createChannelStream({reverse: true, limit: 1000}) | |
56 | - ) | |
57 | - | |
58 | 43 | //disable "Show More" button when we are at the last thread. |
59 | 44 | var disableShowMore = Computed([channelObs], function (threads) { |
60 | 45 | return !!threads.ended |
61 | 46 | }) |
@@ -63,42 +48,29 @@ | ||
63 | 48 | var threadsHtmlObs = More( |
64 | 49 | channelObs, |
65 | 50 | function render (threads) { |
66 | 51 | |
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 | - | |
84 | 52 | morphdom(container, |
85 | 53 | // LEGACY: some of these containers could be removed |
86 | 54 | // but they are here to be compatible with the old MCSS. |
87 | 55 | h('div.container', [ |
88 | 56 | //private section |
89 | 57 | 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] | |
96 | 62 | }) |
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 | + }) | |
97 | 69 | ) |
98 | - ]), | |
99 | - ]) | |
100 | - ) | |
70 | + ]) | |
71 | + ]) | |
72 | + ) | |
101 | 73 | return container |
102 | 74 | } |
103 | 75 | ) |
104 | 76 | |
@@ -115,4 +87,6 @@ | ||
115 | 87 | } |
116 | 88 | |
117 | 89 | |
118 | 90 | |
91 | + | |
92 | + |
Built with git-ssb-web