1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Desktop: Fixes #5686: Fixed Tags Order (#6136)

This commit is contained in:
OmGole
2022-03-02 23:41:14 +05:30
committed by GitHub
parent 98f9ed641c
commit 07f128ae95
5 changed files with 47 additions and 34 deletions

View File

@ -1,6 +1,7 @@
const Folder = require('../../models/Folder').default;
const Setting = require('../../models/Setting').default;
const BaseModel = require('../../BaseModel').default;
const Tag = require('../../models/Tag').default;
const shared = {};
@ -50,20 +51,7 @@ shared.renderFolders = function(props, renderItem) {
};
shared.renderTags = function(props, renderItem) {
const tags = props.tags.slice();
tags.sort((a, b) => {
// It seems title can sometimes be undefined (perhaps when syncing
// and before tag has been decrypted?). It would be best to find
// the root cause but for now that will do.
//
// Fixes https://github.com/laurent22/joplin/issues/4051
if (!a || !a.title || !b || !b.title) return 0;
// Note: while newly created tags are normalized and lowercase
// imported tags might be any case, so we need to do case-insensitive
// sort.
return a.title.toLowerCase() < b.title.toLowerCase() ? -1 : +1;
});
const tags = Tag.sortTags(props.tags.slice());
const tagItems = [];
const order = [];
for (let i = 0; i < tags.length; i++) {