mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 03:29:02 +01:00 
			
		
		
		
	add ignoreMissing flag to becca's getNotes()
This commit is contained in:
		
							parent
							
								
									f9cfd134b7
								
							
						
					
					
						commit
						7261ab69bc
					
				| @ -90,7 +90,7 @@ | |||||||
|     "jsdoc": "3.6.7", |     "jsdoc": "3.6.7", | ||||||
|     "lorem-ipsum": "2.0.3", |     "lorem-ipsum": "2.0.3", | ||||||
|     "rcedit": "3.0.1", |     "rcedit": "3.0.1", | ||||||
|     "webpack": "5.45.1", |     "webpack": "5.46.0", | ||||||
|     "webpack-cli": "4.7.2" |     "webpack-cli": "4.7.2" | ||||||
|   }, |   }, | ||||||
|   "optionalDependencies": { |   "optionalDependencies": { | ||||||
|  | |||||||
| @ -55,13 +55,17 @@ class Becca { | |||||||
|         return this.notes[noteId]; |         return this.notes[noteId]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     getNotes(noteIds) { |     getNotes(noteIds, ignoreMissing = false) { | ||||||
|         const filteredNotes = []; |         const filteredNotes = []; | ||||||
| 
 | 
 | ||||||
|         for (const noteId of noteIds) { |         for (const noteId of noteIds) { | ||||||
|             const note = this.notes[noteId]; |             const note = this.notes[noteId]; | ||||||
| 
 | 
 | ||||||
|             if (!note) { |             if (!note) { | ||||||
|  |                 if (ignoreMissing) { | ||||||
|  |                     continue; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|                 throw new Error(`Note '${noteId}' was not found in becca.`); |                 throw new Error(`Note '${noteId}' was not found in becca.`); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -120,7 +120,7 @@ function getEditedNotesOnDate(req) { | |||||||
|         ORDER BY isDeleted |         ORDER BY isDeleted | ||||||
|         LIMIT 50`, {date: req.params.date + '%'});
 |         LIMIT 50`, {date: req.params.date + '%'});
 | ||||||
| 
 | 
 | ||||||
|     const notes = becca.getNotes(noteIds); |     const notes = becca.getNotes(noteIds, true); | ||||||
| 
 | 
 | ||||||
|     for (const note of notes) { |     for (const note of notes) { | ||||||
|         const notePath = note.isDeleted ? null : beccaService.getNotePath(note.noteId); |         const notePath = note.isDeleted ? null : beccaService.getNotePath(note.noteId); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam