mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
added "hideRelations" label to relation map
This commit is contained in:
@@ -153,7 +153,10 @@ function getRelationMap(req) {
|
||||
.split(",")
|
||||
.map(token => token.trim());
|
||||
|
||||
console.log("displayRelations", displayRelations);
|
||||
const hideRelationsVal = relationMapNote.getLabelValue('hideRelations');
|
||||
const hideRelations = !hideRelationsVal ? [] : hideRelationsVal
|
||||
.split(",")
|
||||
.map(token => token.trim());
|
||||
|
||||
const foundNoteIds = sql.getColumn(`SELECT noteId FROM notes WHERE isDeleted = 0 AND noteId IN (${questionMarks})`, noteIds);
|
||||
const notes = becca.getNotes(foundNoteIds);
|
||||
@@ -163,7 +166,9 @@ function getRelationMap(req) {
|
||||
|
||||
resp.relations = resp.relations.concat(note.getRelations()
|
||||
.filter(relation => !relation.isAutoLink() || displayRelations.includes(relation.name))
|
||||
.filter(relation => displayRelations.length === 0 || displayRelations.includes(relation.name))
|
||||
.filter(relation => displayRelations.length > 0
|
||||
? displayRelations.includes(relation.name)
|
||||
: !hideRelations.includes(relation.name))
|
||||
.filter(relation => noteIds.includes(relation.value))
|
||||
.map(relation => ({
|
||||
attributeId: relation.attributeId,
|
||||
|
||||
Reference in New Issue
Block a user