mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	use owned attributes where it's a better fit
This commit is contained in:
		| @@ -81,7 +81,7 @@ eventService.subscribe(eventService.CHILD_NOTE_CREATED, async ({ parentNote, chi | |||||||
| async function processInverseRelations(entityName, entity, handler) { | async function processInverseRelations(entityName, entity, handler) { | ||||||
|     if (entityName === 'attributes' && entity.type === 'relation') { |     if (entityName === 'attributes' && entity.type === 'relation') { | ||||||
|         const note = await entity.getNote(); |         const note = await entity.getNote(); | ||||||
|         const attributes = (await note.getAttributes(entity.name)).filter(relation => relation.type === 'relation-definition'); |         const attributes = (await note.getOwnedAttributes(entity.name)).filter(relation => relation.type === 'relation-definition'); | ||||||
|  |  | ||||||
|         for (const attribute of attributes) { |         for (const attribute of attributes) { | ||||||
|             const definition = attribute.value; |             const definition = attribute.value; | ||||||
|   | |||||||
| @@ -514,7 +514,7 @@ async function duplicateNote(noteId, parentNoteId) { | |||||||
|         notePosition: origBranch ? origBranch.notePosition + 1 : null |         notePosition: origBranch ? origBranch.notePosition + 1 : null | ||||||
|     }).save(); |     }).save(); | ||||||
|  |  | ||||||
|     for (const attribute of await origNote.getAttributes()) { |     for (const attribute of await origNote.getOwnedAttributes()) { | ||||||
|         const attr = new Attribute(attribute); |         const attr = new Attribute(attribute); | ||||||
|         attr.attributeId = undefined; // force creation of new attribute |         attr.attributeId = undefined; // force creation of new attribute | ||||||
|         attr.noteId = newNote.noteId; |         attr.noteId = newNote.noteId; | ||||||
| @@ -530,7 +530,7 @@ async function duplicateNote(noteId, parentNoteId) { | |||||||
|  |  | ||||||
| sqlInit.dbReady.then(() => { | sqlInit.dbReady.then(() => { | ||||||
|     // first cleanup kickoff 5 minutes after startup |     // first cleanup kickoff 5 minutes after startup | ||||||
|     setTimeout(cls.wrap(eraseDeletedNotes), 0 * 60 * 1000); |     setTimeout(cls.wrap(eraseDeletedNotes), 5 * 60 * 1000); | ||||||
|  |  | ||||||
|     setInterval(cls.wrap(eraseDeletedNotes), 4 * 3600 * 1000); |     setInterval(cls.wrap(eraseDeletedNotes), 4 * 3600 * 1000); | ||||||
| }); | }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user