1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix live note counts when multiple tags are selected

This commit is contained in:
Baptiste Augrain
2018-08-28 01:44:33 +02:00
parent 7cde30d352
commit 5006aaae38

View File

@@ -19,8 +19,8 @@ import {SortableContainer} from 'react-sortable-hoc'
import i18n from 'browser/lib/i18n'
import context from 'browser/lib/context'
function findOne (haystack, arr) {
return arr.some(v => haystack.indexOf(v) >= 0)
function matchActiveTags (tags, activeTags) {
return _.every(activeTags, v => tags.indexOf(v) >= 0)
}
class SideNav extends React.Component {
@@ -158,7 +158,7 @@ class SideNav extends React.Component {
if (config.ui.enableLiveNoteCounts && activeTags.length !== 0) {
const notesTags = data.noteMap.map(note => note.tags)
tagList = tagList.map(tag => {
tag.size = notesTags.filter(tags => tags.includes(tag.name) && findOne(tags, activeTags)).length
tag.size = notesTags.filter(tags => tags.includes(tag.name) && matchActiveTags(tags, activeTags)).length
return tag
})
}