git ssb

16+

Dominic / patchbay



Commit 57ede789ed0c6b572f9e213d61e7fe18428a643b

Fix follow filter, make isfiltered work again

Anders Rune Jensen authored on 9/18/2017, 7:06:13 PM
mix irving committed on 10/27/2017, 4:57:33 AM
Parent: e2c1d29fd59c7f5fa88e9d4e8e526de67e61915f

Files changed

app/html/filter.jschanged
app/sync/initialise/settings.jschanged
app/html/filter.jsView
@@ -5,8 +5,9 @@
55 const addSuggest = require('suggest-box')
66 const { isFeed } = require('ssb-ref')
77 const some = require('lodash/some')
88 const get = require('lodash/get')
9 +const isEqual = require('lodash/isEqual')
910
1011 exports.gives = nest('app.html.filter')
1112
1213 exports.needs = nest({
@@ -35,15 +36,11 @@
3536 const filterSettings = api.settings.obs.get('filter')
3637
3738 // this needs to show if the filter has changed from default ?...?
3839 const isFiltered = computed([onlyAuthor, filterSettings], (onlyAuthor, filterSettings) => {
39- return onlyAuthor || filterSettings.only.peopleIFollow || some(filterSettings.show, false)
40 + return onlyAuthor || filterSettings.only.peopleIFollow || !isEqual(filterSettings.show, filterSettings.defaults.show)
4041 })
4142
42- // const isFiltered = computed([onlyPeopleIFollow, onlyAuthor, showPost, showAbout, showVote, showContact, showChannel, showPub, showChess], (onlyPeopleIFollow, onlyAuthor, showPost, showAbout, showVote, showContact, showChannel, showPub) => {
43- // return onlyPeopleIFollow || onlyAuthor || !showPost || !showAbout || showVote || showContact || showChannel || showPub || !showChess
44- // })
45-
4643 const authorInput = h('input', {
4744 'ev-keyup': (ev) => {
4845 const author = ev.target.value
4946 if (author && !isFeed(author)) return
@@ -56,10 +53,9 @@
5653 const filterMenu = h('Filter', [
5754 h('i', {
5855 classList: when(showFilters,
5956 'fa fa-filter -active',
60- 'fa fa-filter'
61- // when(isFiltered, 'fa fa-filter -filtered', 'fa fa-filter')
57 + when(isFiltered, 'fa fa-filter -filtered', 'fa fa-filter')
6258 ),
6359 'ev-click': () => showFilters.set(!showFilters())
6460 }),
6561 h('i.fa.fa-angle-up', { 'ev-click': draw }),
@@ -72,9 +68,9 @@
7268 h('div.author', [
7369 h('label', 'Show author'),
7470 authorInput
7571 ]),
76- toggle({ type: 'peopleIfollow', filterGroup: 'only', label: 'Only people I follow' }),
72 + toggle({ type: 'peopleIFollow', filterGroup: 'only', label: 'Only people I follow' }),
7773 h('div.message-types', [
7874 h('header', 'Show messages'),
7975 toggle({ type: 'post' }),
8076 toggle({ type: 'like' }),
app/sync/initialise/settings.jsView
@@ -30,8 +30,9 @@
3030
3131 function initialiseSettings () {
3232 const { get, set } = api.settings.sync
3333 const settings = merge({}, defaults, get())
34 + settings.filter.defaults = defaults.filter
3435
3536 set(settings)
3637 }
3738 }

Built with git-ssb-web