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:
@@ -19,8 +19,8 @@ import {SortableContainer} from 'react-sortable-hoc'
|
|||||||
import i18n from 'browser/lib/i18n'
|
import i18n from 'browser/lib/i18n'
|
||||||
import context from 'browser/lib/context'
|
import context from 'browser/lib/context'
|
||||||
|
|
||||||
function findOne (haystack, arr) {
|
function matchActiveTags (tags, activeTags) {
|
||||||
return arr.some(v => haystack.indexOf(v) >= 0)
|
return _.every(activeTags, v => tags.indexOf(v) >= 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
class SideNav extends React.Component {
|
class SideNav extends React.Component {
|
||||||
@@ -158,7 +158,7 @@ class SideNav extends React.Component {
|
|||||||
if (config.ui.enableLiveNoteCounts && activeTags.length !== 0) {
|
if (config.ui.enableLiveNoteCounts && activeTags.length !== 0) {
|
||||||
const notesTags = data.noteMap.map(note => note.tags)
|
const notesTags = data.noteMap.map(note => note.tags)
|
||||||
tagList = tagList.map(tag => {
|
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
|
return tag
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user