1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

All: Fixes #3997: Display note count for conflict folder, and display notes even if they are completed to-dos

This commit is contained in:
Laurent Cozic
2020-11-14 12:37:18 +00:00
parent 2b95bce272
commit 7f88f507df
7 changed files with 81 additions and 52 deletions

View File

@@ -306,8 +306,8 @@ class Note extends BaseItem {
}
static async previews(parentId, options = null) {
// Note: ordering logic must be duplicated in sortNotes(), which
// is used to sort already loaded notes.
// Note: ordering logic must be duplicated in sortNotes(), which is used
// to sort already loaded notes.
if (!options) options = {};
if (!('order' in options)) options.order = [{ by: 'user_updated_time', dir: 'DESC' }, { by: 'user_created_time', dir: 'DESC' }, { by: 'title', dir: 'DESC' }, { by: 'id', dir: 'DESC' }];
@@ -317,7 +317,13 @@ class Note extends BaseItem {
if (!options.uncompletedTodosOnTop) options.uncompletedTodosOnTop = false;
if (!('showCompletedTodos' in options)) options.showCompletedTodos = true;
if (parentId == BaseItem.getClass('Folder').conflictFolderId()) {
const Folder = BaseItem.getClass('Folder');
// Conflicts are always displayed regardless of options, since otherwise
// it's confusing to have conflicts but with an empty conflict folder.
if (parentId === Folder.conflictFolderId()) options.showCompletedTodos = true;
if (parentId == Folder.conflictFolderId()) {
options.conditions.push('is_conflict = 1');
} else {
options.conditions.push('is_conflict = 0');