mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	fix undelete attachments
This commit is contained in:
		| @@ -15,6 +15,7 @@ const becca = require('../becca/becca'); | ||||
| const BBranch = require('../becca/entities/bbranch'); | ||||
| const BNote = require('../becca/entities/bnote'); | ||||
| const BAttribute = require('../becca/entities/battribute'); | ||||
| const BAttachment = require("../becca/entities/battachment"); | ||||
| const dayjs = require("dayjs"); | ||||
| const htmlSanitizer = require("./html_sanitizer"); | ||||
| const ValidationError = require("../errors/validation_error"); | ||||
| @@ -810,6 +811,16 @@ function undeleteBranch(branchId, deleteId, taskContext) { | ||||
|             new BAttribute(attributeRow).save({skipValidation: true}); | ||||
|         } | ||||
|  | ||||
|         const attachmentRows = sql.getRows(` | ||||
|             SELECT * FROM attachments | ||||
|             WHERE isDeleted = 1 | ||||
|               AND deleteId = ? | ||||
|               AND ownerId = ?`, [deleteId, noteRow.noteId]); | ||||
|  | ||||
|         for (const attachmentRow of attachmentRows) { | ||||
|             new BAttachment(attachmentRow).save(); | ||||
|         } | ||||
|  | ||||
|         const childBranchIds = sql.getColumn(` | ||||
|             SELECT branches.branchId | ||||
|             FROM branches | ||||
|   | ||||
		Reference in New Issue
	
	Block a user