mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	fix showing deleted notes in the recent changes dialog, closes #4013
This commit is contained in:
		
							parent
							
								
									8bc84cfaf6
								
							
						
					
					
						commit
						6e69cafe54
					
				@ -27,7 +27,8 @@ function getRecentChanges(req) {
 | 
				
			|||||||
    for (const noteRevisionRow of noteRevisionRows) {
 | 
					    for (const noteRevisionRow of noteRevisionRows) {
 | 
				
			||||||
        const note = becca.getNote(noteRevisionRow.noteId);
 | 
					        const note = becca.getNote(noteRevisionRow.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (note?.hasAncestor(ancestorNoteId)) {
 | 
					        // for deleted notes, the becca note is null, and it's not possible to (easily) determine if it belongs to a subtree
 | 
				
			||||||
 | 
					        if (ancestorNoteId === 'root' || note?.hasAncestor(ancestorNoteId)) {
 | 
				
			||||||
            recentChanges.push(noteRevisionRow);
 | 
					            recentChanges.push(noteRevisionRow);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -43,8 +44,8 @@ function getRecentChanges(req) {
 | 
				
			|||||||
                notes.title AS current_title,
 | 
					                notes.title AS current_title,
 | 
				
			||||||
                notes.isProtected AS current_isProtected,
 | 
					                notes.isProtected AS current_isProtected,
 | 
				
			||||||
                notes.title,
 | 
					                notes.title,
 | 
				
			||||||
                notes.utcDateCreated AS utcDate,
 | 
					                notes.utcDateCreated AS utcDate, -- different from the second SELECT
 | 
				
			||||||
                notes.dateCreated AS date
 | 
					                notes.dateCreated AS date        -- different from the second SELECT
 | 
				
			||||||
            FROM notes
 | 
					            FROM notes
 | 
				
			||||||
        UNION ALL
 | 
					        UNION ALL
 | 
				
			||||||
            SELECT
 | 
					            SELECT
 | 
				
			||||||
@ -54,15 +55,16 @@ function getRecentChanges(req) {
 | 
				
			|||||||
                notes.title AS current_title,
 | 
					                notes.title AS current_title,
 | 
				
			||||||
                notes.isProtected AS current_isProtected,
 | 
					                notes.isProtected AS current_isProtected,
 | 
				
			||||||
                notes.title,
 | 
					                notes.title,
 | 
				
			||||||
                notes.utcDateModified AS utcDate,
 | 
					                notes.utcDateModified AS utcDate, -- different from the first SELECT
 | 
				
			||||||
                notes.dateModified AS date
 | 
					                notes.dateModified AS date        -- different from the first SELECT
 | 
				
			||||||
            FROM notes
 | 
					            FROM notes
 | 
				
			||||||
            WHERE notes.isDeleted = 1`);
 | 
					            WHERE notes.isDeleted = 1`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const noteRow of noteRows) {
 | 
					    for (const noteRow of noteRows) {
 | 
				
			||||||
        const note = becca.getNote(noteRow.noteId);
 | 
					        const note = becca.getNote(noteRow.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (note?.hasAncestor(ancestorNoteId)) {
 | 
					        // for deleted notes, the becca note is null, and it's not possible to (easily) determine if it belongs to a subtree
 | 
				
			||||||
 | 
					        if (ancestorNoteId === 'root' || note?.hasAncestor(ancestorNoteId)) {
 | 
				
			||||||
            recentChanges.push(noteRow);
 | 
					            recentChanges.push(noteRow);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user