mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	fix sharing of templates, #3562
This commit is contained in:
		
							parent
							
								
									88e09eb279
								
							
						
					
					
						commit
						460b5fb3a4
					
				@ -707,7 +707,7 @@ class FNote {
 | 
				
			|||||||
        return promotedAttrs;
 | 
					        return promotedAttrs;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    hasAncestor(ancestorNoteId, visitedNoteIds = null) {
 | 
					    hasAncestor(ancestorNoteId, followTemplates = false, visitedNoteIds = null) {
 | 
				
			||||||
        if (this.noteId === ancestorNoteId) {
 | 
					        if (this.noteId === ancestorNoteId) {
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -721,14 +721,16 @@ class FNote {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        visitedNoteIds.add(this.noteId);
 | 
					        visitedNoteIds.add(this.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (const templateNote of this.getNotesToInheritAttributesFrom()) {
 | 
					        if (followTemplates) {
 | 
				
			||||||
            if (templateNote.hasAncestor(ancestorNoteId, visitedNoteIds)) {
 | 
					            for (const templateNote of this.getNotesToInheritAttributesFrom()) {
 | 
				
			||||||
                return true;
 | 
					                if (templateNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) {
 | 
				
			||||||
 | 
					                    return true;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (const parentNote of this.getParentNotes()) {
 | 
					        for (const parentNote of this.getParentNotes()) {
 | 
				
			||||||
            if (parentNote.hasAncestor(ancestorNoteId, visitedNoteIds)) {
 | 
					            if (parentNote.hasAncestor(ancestorNoteId, followTemplates, visitedNoteIds)) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -50,7 +50,7 @@ function isAffecting(attrRow, affectedNote) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (this.isInheritable) {
 | 
					    if (this.isInheritable) {
 | 
				
			||||||
        for (const owningNote of owningNotes) {
 | 
					        for (const owningNote of owningNotes) {
 | 
				
			||||||
            if (owningNote.hasAncestor(attrNote.noteId)) {
 | 
					            if (owningNote.hasAncestor(attrNote.noteId, true)) {
 | 
				
			||||||
                return true;
 | 
					                return true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user