Commit eba890bb7df89e06d7b260c4ad65b42369b4c27e
issue #70: bug related to observable fixed.
andre alves garzia committed on 2/6/2018, 1:53:08 AMParent: bfc0ca818ad29350778f773418c29b2622aca346
Files changed
app/page/channelShow.js | changed |
app/page/channelSubscriptions.js | changed |
app/page/channelShow.js | ||
---|---|---|
@@ -31,18 +31,9 @@ | ||
31 | 31 | const { subscribe, unsubscribe } = api.channel.async |
32 | 32 | const { isSubscribedTo } = api.channel.obs |
33 | 33 | const youSubscribe = isSubscribedTo(location.channel, myId) |
34 | 34 | |
35 | - let cb = () => { | |
36 | - youSubscribe.set(isSubscribedTo(location.channel, myId)) | |
37 | - } | |
38 | - | |
39 | 35 | var searchVal = resolve(location.channel) |
40 | - var searchResults = computed([api.channel.obs.recent(), searchVal], (channels, val) => { | |
41 | - if (val.length < 2) return [] | |
42 | - | |
43 | - return channels.filter(c => c.toLowerCase().indexOf(val.toLowerCase()) > -1) | |
44 | - }) | |
45 | 36 | |
46 | 37 | |
47 | 38 | |
48 | 39 | createStream = api.feed.pull.channel(location.channel) |
@@ -53,10 +44,10 @@ | ||
53 | 44 | h('section.about', [ |
54 | 45 | h('h1', location.channel), |
55 | 46 | h('div.actions', [ |
56 | 47 | when(youSubscribe, |
57 | - h('Button', { 'ev-click': () => subscribe(location.channel, cb) }, strings.channelShow.action.unsubscribe), | |
58 | - h('Button', { 'ev-click': () => unsubscribe(location.channel, cb) }, strings.channelShow.action.subscribe) | |
48 | + h('Button', { 'ev-click': () => subscribe(location.channel) }, strings.channelShow.action.unsubscribe), | |
49 | + h('Button', { 'ev-click': () => unsubscribe(location.channel) }, strings.channelShow.action.subscribe) | |
59 | 50 | ) |
60 | 51 | ]) |
61 | 52 | ]), |
62 | 53 | ] |
app/page/channelSubscriptions.js | ||
---|---|---|
@@ -39,9 +39,9 @@ | ||
39 | 39 | h('div.content', [ |
40 | 40 | //api.app.html.topNav(location), |
41 | 41 | when(myChannels, |
42 | 42 | mutantMap(mySubscriptions, api.app.html.channelCard), |
43 | - h("p", "Loading...") | |
43 | + h("p", strings.loading) | |
44 | 44 | ) |
45 | 45 | ]) |
46 | 46 | ]) |
47 | 47 | |
@@ -57,25 +57,23 @@ | ||
57 | 57 | sbot.channel.get((err, c) => { |
58 | 58 | if (err) throw err |
59 | 59 | let b = map(c, (v,k) => {return {channel: k, users: v}}) |
60 | 60 | b = sortBy(b, o => o.users.length) |
61 | - myChannels.set(b.reverse().slice(0,100)) | |
61 | + let res = b.reverse().slice(0,100) | |
62 | + | |
63 | + myChannels.set(res.map(c => c.channel)) | |
62 | 64 | }) |
63 | 65 | } |
64 | 66 | ) |
65 | 67 | |
66 | 68 | |
67 | - displaySubscriptions = () => { | |
68 | - if (myChannels()) { | |
69 | - let subs = myChannels() | |
70 | - return subs.map(c => api.app.html.channelCard(c.channel)) | |
71 | - } | |
72 | - } | |
73 | - | |
74 | - return h('Page -channelSubscriptions', { title: strings.home }, [ | |
69 | + return h('Page -channelSubscriptions', { title: strings.home }, [ | |
75 | 70 | api.app.html.sideNav(location), |
76 | 71 | h('div.content', [ |
77 | - when(myChannels, displaySubscriptions, h("p", strings.loading)) | |
72 | + when(myChannels, | |
73 | + mutantMap(myChannels, api.app.html.channelCard), | |
74 | + h("p", strings.loading) | |
75 | + ) | |
78 | 76 | ]) |
79 | 77 | ]) |
80 | 78 | } |
81 | 79 | }) |
Built with git-ssb-web