mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	added isBeingDeleted to be able to recognize that note is being deleted while still leaving it accessible
This commit is contained in:
		
							parent
							
								
									aec2c2d5cd
								
							
						
					
					
						commit
						d64b575e60
					
				| @ -113,7 +113,13 @@ class Attribute extends AbstractEntity { | |||||||
|      * @returns {Note|null} |      * @returns {Note|null} | ||||||
|      */ |      */ | ||||||
|     getNote() { |     getNote() { | ||||||
|         return this.becca.getNote(this.noteId); |         const note = this.becca.getNote(this.noteId); | ||||||
|  | 
 | ||||||
|  |         if (!note) { | ||||||
|  |             throw new Error(`Note '${this.noteId}' of attribute '${this.attributeId}', type '${this.type}', name '${this.name}' does not exist.`); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return note; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -187,9 +187,7 @@ class Branch extends AbstractEntity { | |||||||
| 
 | 
 | ||||||
|             log.info("Deleting note " + note.noteId); |             log.info("Deleting note " + note.noteId); | ||||||
| 
 | 
 | ||||||
|             // marking note as deleted as a signal to event handlers that the note is being deleted
 |             this.becca.notes[note.noteId].isBeingDeleted = true; | ||||||
|             // (isDeleted is being checked against becca)
 |  | ||||||
|             delete this.becca.notes[note.noteId]; |  | ||||||
| 
 | 
 | ||||||
|             for (const attribute of note.getOwnedAttributes()) { |             for (const attribute of note.getOwnedAttributes()) { | ||||||
|                 attribute.markAsDeleted(deleteId); |                 attribute.markAsDeleted(deleteId); | ||||||
|  | |||||||
| @ -72,6 +72,8 @@ class Note extends AbstractEntity { | |||||||
|         this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); |         this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); | ||||||
|         /** @type {string} */ |         /** @type {string} */ | ||||||
|         this.utcDateModified = utcDateModified; |         this.utcDateModified = utcDateModified; | ||||||
|  |         /** @type {boolean} - set during the deletion operation, before it is completed (removed from becca completely) */ | ||||||
|  |         this.isBeingDeleted = false; | ||||||
| 
 | 
 | ||||||
|         // ------ Derived attributes ------
 |         // ------ Derived attributes ------
 | ||||||
| 
 | 
 | ||||||
| @ -1327,7 +1329,7 @@ class Note extends AbstractEntity { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     get isDeleted() { |     get isDeleted() { | ||||||
|         return !(this.noteId in this.becca.notes); |         return !(this.noteId in this.becca.notes) || this.isBeingDeleted; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam