mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	make "excludeFromNoteMap" overridable with note.isLabelTruthy(), #4058
This commit is contained in:
		@@ -57,7 +57,7 @@ function getNeighbors(note, depth) {
 | 
			
		||||
 | 
			
		||||
        const targetNote = relation.getTargetNote();
 | 
			
		||||
 | 
			
		||||
        if (!targetNote || targetNote.hasLabel('excludeFromNoteMap')) {
 | 
			
		||||
        if (!targetNote || targetNote.isLabelTruthy('excludeFromNoteMap')) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -76,7 +76,7 @@ function getNeighbors(note, depth) {
 | 
			
		||||
 | 
			
		||||
        const sourceNote = relation.getNote();
 | 
			
		||||
 | 
			
		||||
        if (!sourceNote || sourceNote.hasLabel('excludeFromNoteMap')) {
 | 
			
		||||
        if (!sourceNote || sourceNote.isLabelTruthy('excludeFromNoteMap')) {
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -94,7 +94,7 @@ function getLinkMap(req) {
 | 
			
		||||
    const mapRootNote = becca.getNote(req.params.noteId);
 | 
			
		||||
    // if the map root itself has exclude attribute (journal typically) then there wouldn't be anything to display, so
 | 
			
		||||
    // we'll just ignore it
 | 
			
		||||
    const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
 | 
			
		||||
    const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
 | 
			
		||||
    let unfilteredNotes;
 | 
			
		||||
 | 
			
		||||
    if (mapRootNote.type === 'search') {
 | 
			
		||||
@@ -110,7 +110,7 @@ function getLinkMap(req) {
 | 
			
		||||
 | 
			
		||||
    const noteIds = new Set(
 | 
			
		||||
        unfilteredNotes
 | 
			
		||||
            .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
 | 
			
		||||
            .filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
 | 
			
		||||
            .map(note => note.noteId)
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
@@ -169,7 +169,7 @@ function getTreeMap(req) {
 | 
			
		||||
    const mapRootNote = becca.getNote(req.params.noteId);
 | 
			
		||||
    // if the map root itself has ignore (journal typically) then there wouldn't be anything to display, so
 | 
			
		||||
    // we'll just ignore it
 | 
			
		||||
    const ignoreExcludeFromNoteMap = mapRootNote.hasLabel('excludeFromNoteMap');
 | 
			
		||||
    const ignoreExcludeFromNoteMap = mapRootNote.isLabelTruthy('excludeFromNoteMap');
 | 
			
		||||
    const subtree = mapRootNote.getSubtree({
 | 
			
		||||
        includeArchived: false,
 | 
			
		||||
        resolveSearch: true,
 | 
			
		||||
@@ -177,7 +177,7 @@ function getTreeMap(req) {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    const notes = subtree.notes
 | 
			
		||||
        .filter(note => ignoreExcludeFromNoteMap || !note.hasLabel('excludeFromNoteMap'))
 | 
			
		||||
        .filter(note => ignoreExcludeFromNoteMap || !note.isLabelTruthy('excludeFromNoteMap'))
 | 
			
		||||
        .filter(note => {
 | 
			
		||||
            if (note.type !== 'image' || note.getChildNotes().length > 0) {
 | 
			
		||||
                return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user