mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
Compare commits
3 Commits
v0.37.1-be
...
v0.37.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5acb7fc9b | ||
|
|
834e1f7253 | ||
|
|
1a87190f43 |
@@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.37.1-beta",
|
||||
"version": "0.37.2",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
||||
@@ -148,7 +148,7 @@ class TreeCache {
|
||||
else {
|
||||
return this.notes[noteId];
|
||||
}
|
||||
}).filter(note => note !== null);
|
||||
}).filter(note => !!note);
|
||||
}
|
||||
|
||||
/** @return {Promise<boolean>} */
|
||||
|
||||
@@ -1 +1 @@
|
||||
module.exports = { buildDate:"2019-11-16T19:09:52+01:00", buildRevision: "1838f097e537eedc958b52ee82093e43ab5b9908" };
|
||||
module.exports = { buildDate:"2019-11-18T23:04:09+01:00", buildRevision: "834e1f7253186922d2b5df2f6a01c34f7c2d7fe4" };
|
||||
|
||||
@@ -67,7 +67,7 @@ module.exports = function(filters, selectedColumns = 'notes.*') {
|
||||
const params = [];
|
||||
|
||||
for (const filter of filters) {
|
||||
if (['isarchived', 'orderby', 'limit'].includes(filter.name.toLowerCase())) {
|
||||
if (['isarchived', 'in', 'orderby', 'limit'].includes(filter.name.toLowerCase())) {
|
||||
continue; // these are not real filters
|
||||
}
|
||||
|
||||
|
||||
@@ -255,6 +255,25 @@ function isArchived(noteId) {
|
||||
return isNotePathArchived(notePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} noteId
|
||||
* @param {string} ancestorNoteId
|
||||
* @return {boolean} - true if given noteId has ancestorNoteId in any of its paths (even archived)
|
||||
*/
|
||||
function isInAncestor(noteId, ancestorNoteId) {
|
||||
if (ancestorNoteId === noteId) { // special case
|
||||
return true;
|
||||
}
|
||||
|
||||
for (const parentNoteId of childToParent[noteId] || []) {
|
||||
if (isInAncestor(parentNoteId, ancestorNoteId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getNoteTitleFromPath(notePath) {
|
||||
const pathArr = notePath.split("/");
|
||||
|
||||
@@ -529,6 +548,7 @@ module.exports = {
|
||||
getNoteTitleFromPath,
|
||||
isAvailable,
|
||||
isArchived,
|
||||
isInAncestor,
|
||||
load,
|
||||
findSimilarNotes
|
||||
};
|
||||
@@ -35,6 +35,20 @@ async function searchForNoteIds(searchString) {
|
||||
}
|
||||
}
|
||||
|
||||
const isInFilter = filters.find(filter => filter.name.toLowerCase() === 'in');
|
||||
|
||||
if (isInFilter) {
|
||||
if (isInFilter.operator === '=') {
|
||||
noteIds = noteIds.filter(noteId => noteCacheService.isInAncestor(noteId, isInFilter.value));
|
||||
}
|
||||
else if (isInFilter.operator === '!=') {
|
||||
noteIds = noteIds.filter(noteId => !noteCacheService.isInAncestor(noteId, isInFilter.value));
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unrecognized isIn operator ${isInFilter.operator}`);
|
||||
}
|
||||
}
|
||||
|
||||
const limitFilter = filters.find(filter => filter.name.toLowerCase() === 'limit');
|
||||
|
||||
if (limitFilter) {
|
||||
|
||||
Reference in New Issue
Block a user