1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: Added Thunderbird count for desktop client (#3880)

This commit is contained in:
Anton Tuchkov 2020-10-12 14:13:41 +05:00 committed by GitHub
parent 2d099b2bed
commit 5fd0408365
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -361,6 +361,17 @@ class SideBarComponent extends React.Component<Props, State> {
renderFolderItem(folder:any, selected:boolean, hasChildren:boolean, depth:number) {
const anchorRef = this.anchorItemRef('folder', folder.id);
const isExpanded = this.props.collapsedFolderIds.indexOf(folder.id) < 0;
let noteCount = folder.note_count;
// Thunderbird count: Subtract children note_count from parent folder if it expanded.
if (isExpanded) {
for (let i = 0; i < this.props.folders.length; i++) {
if (this.props.folders[i].parent_id === folder.id) {
noteCount -= this.props.folders[i].note_count;
}
}
}
return <FolderItem
key={folder.id}
@ -369,10 +380,10 @@ class SideBarComponent extends React.Component<Props, State> {
themeId={this.props.themeId}
depth={depth}
selected={selected}
isExpanded={this.props.collapsedFolderIds.indexOf(folder.id) < 0}
isExpanded={isExpanded}
hasChildren={hasChildren}
anchorRef={anchorRef}
noteCount={folder.note_count}
noteCount={noteCount}
onFolderDragStart_={this.onFolderDragStart_}
onFolderDragOver_={this.onFolderDragOver_}
onFolderDrop_={this.onFolderDrop_}