Commit 13b1df716aa0e61f57f567bce7d3a64e14243907
page/public: filter subscription messages, and add setting
also change setting name for page/channelMina Nagy Zaki committed on 1/21/2018, 12:06:22 PM
Parent: 4d59028f7e5dfb19b6a808394322180ab18e3b65
Files changed
modules/page/html/render/channel.js | changed |
modules/page/html/render/public.js | changed |
modules/page/html/render/settings.js | changed |
modules/page/html/render/channel.js | ||
---|---|---|
@@ -61,12 +61,12 @@ | ||
61 | 61 | |
62 | 62 | return channelView |
63 | 63 | |
64 | 64 | function checkFeedFilter (msg) { |
65 | - const filterObj = filters(), | |
66 | - msgType = msg && msg.value && msg.value.content && | |
67 | - msg.value.content.type | |
65 | + const filterObj = filters() && filters().channelView; | |
68 | 66 | if (filterObj) { |
67 | + const msgType = msg && msg.value && msg.value.content && | |
68 | + msg.value.content.type | |
69 | 69 | // filter out channel subscription messages |
70 | 70 | if (filterObj.subscriptions && msgType === 'channel') |
71 | 71 | return false |
72 | 72 | } |
modules/page/html/render/public.js | ||
---|---|---|
@@ -140,10 +140,15 @@ | ||
140 | 140 | |
141 | 141 | return result |
142 | 142 | |
143 | 143 | function checkFeedFilter (root) { |
144 | - if (filters()) { | |
145 | - if (filters().following && getType(root) === 'contact') return false | |
144 | + const filterObj = filters() | |
145 | + if (filterObj) { | |
146 | + const rootType = getType(root) | |
147 | + if ( | |
148 | + filterObj.following && rootType === 'contact' || | |
149 | + filterObj.subscriptions && rootType === 'channel' | |
150 | + ) return false | |
146 | 151 | } |
147 | 152 | return true |
148 | 153 | } |
149 | 154 |
modules/page/html/render/settings.js | ||
---|---|---|
@@ -28,8 +28,9 @@ | ||
28 | 28 | const fontSize = api.settings.obs.get('patchwork.fontSize', '') |
29 | 29 | const filterFollowing = api.settings.obs.get('filters.following') |
30 | 30 | const filterSubscriptions = api.settings.obs.get('filters.subscriptions') |
31 | 31 | const onlySubscribed = api.settings.obs.get('filters.onlySubscribed') |
32 | + const filterChannelViewSubscriptions = api.settings.obs.get('filters.channelView.subscriptions') | |
32 | 33 | |
33 | 34 | var prepend = [ |
34 | 35 | h('PageHeading', [ |
35 | 36 | h('h1', [ |
@@ -89,8 +90,14 @@ | ||
89 | 90 | }) |
90 | 91 | ]), |
91 | 92 | |
92 | 93 | h('div', [ |
94 | + checkbox(filterSubscriptions, { | |
95 | + label: i18n('Hide channel (un)subcribe messages') | |
96 | + }) | |
97 | + ]), | |
98 | + | |
99 | + h('div', [ | |
93 | 100 | checkbox(onlySubscribed, { |
94 | 101 | label: i18n('Only include posts from subscribed channels') |
95 | 102 | }) |
96 | 103 | ]) |
@@ -99,9 +106,9 @@ | ||
99 | 106 | h('section', [ |
100 | 107 | h('h2', i18n('Channel Feed Options')), |
101 | 108 | |
102 | 109 | h('div', [ |
103 | - checkbox(filterSubscriptions, { | |
110 | + checkbox(filterChannelViewSubscriptions, { | |
104 | 111 | label: i18n('Hide channel (un)subcribe messages') |
105 | 112 | }) |
106 | 113 | ]) |
107 | 114 | ]), |
Built with git-ssb-web