git ssb

10+

Matt McKegg / patchwork



Commit 13b1df716aa0e61f57f567bce7d3a64e14243907

page/public: filter subscription messages, and add setting

also change setting name for page/channel
Mina Nagy Zaki committed on 1/21/2018, 12:06:22 PM
Parent: 4d59028f7e5dfb19b6a808394322180ab18e3b65

Files changed

modules/page/html/render/channel.jschanged
modules/page/html/render/public.jschanged
modules/page/html/render/settings.jschanged
modules/page/html/render/channel.jsView
@@ -61,12 +61,12 @@
6161
6262 return channelView
6363
6464 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;
6866 if (filterObj) {
67+ const msgType = msg && msg.value && msg.value.content &&
68+ msg.value.content.type
6969 // filter out channel subscription messages
7070 if (filterObj.subscriptions && msgType === 'channel')
7171 return false
7272 }
modules/page/html/render/public.jsView
@@ -140,10 +140,15 @@
140140
141141 return result
142142
143143 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
146151 }
147152 return true
148153 }
149154
modules/page/html/render/settings.jsView
@@ -28,8 +28,9 @@
2828 const fontSize = api.settings.obs.get('patchwork.fontSize', '')
2929 const filterFollowing = api.settings.obs.get('filters.following')
3030 const filterSubscriptions = api.settings.obs.get('filters.subscriptions')
3131 const onlySubscribed = api.settings.obs.get('filters.onlySubscribed')
32+ const filterChannelViewSubscriptions = api.settings.obs.get('filters.channelView.subscriptions')
3233
3334 var prepend = [
3435 h('PageHeading', [
3536 h('h1', [
@@ -89,8 +90,14 @@
8990 })
9091 ]),
9192
9293 h('div', [
94+ checkbox(filterSubscriptions, {
95+ label: i18n('Hide channel (un)subcribe messages')
96+ })
97+ ]),
98+
99+ h('div', [
93100 checkbox(onlySubscribed, {
94101 label: i18n('Only include posts from subscribed channels')
95102 })
96103 ])
@@ -99,9 +106,9 @@
99106 h('section', [
100107 h('h2', i18n('Channel Feed Options')),
101108
102109 h('div', [
103- checkbox(filterSubscriptions, {
110+ checkbox(filterChannelViewSubscriptions, {
104111 label: i18n('Hide channel (un)subcribe messages')
105112 })
106113 ])
107114 ]),

Built with git-ssb-web