1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

Clipper: Fixes #1417: Sort the folders in the same order as the desktop app

This commit is contained in:
Laurent Cozic
2019-04-20 19:29:23 +01:00
parent c3262aa5f8
commit 4ef05272c4
3 changed files with 17 additions and 7 deletions

View File

@ -3,22 +3,29 @@ const Setting = require('lib/models/Setting.js');
class FoldersScreenUtils {
static async refreshFolders() {
static async allForDisplay(options = {}) {
const orderDir = Setting.value('folders.sortOrder.reverse') ? 'DESC' : 'ASC';
let folders = await Folder.all({
includeConflictFolder: true,
const folderOptions = Object.assign({}, {
caseInsensitive: true,
order: [{
by: 'title',
dir: orderDir,
}]
});
}, options);
let folders = await Folder.all(folderOptions);
if (Setting.value('folders.sortOrder.field') === 'last_note_user_updated_time') {
folders = await Folder.orderByLastModified(folders, orderDir);
}
return folders;
}
static async refreshFolders() {
const folders = await this.allForDisplay({ includeConflictFolder: true });
this.dispatch({
type: 'FOLDER_UPDATE_ALL',
items: folders,