mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	fix inverse relation creation, closes #1498
This commit is contained in:
		
							parent
							
								
									b093569ec5
								
							
						
					
					
						commit
						eaf93a70cd
					
				| @ -9,7 +9,7 @@ async function syncNow() { | |||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         if (result.message.length > 200) { |         if (result.message.length > 200) { | ||||||
|             result.message = result.message.substr(0, 200); |             result.message = result.message.substr(0, 200) + "..."; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         toastService.showError("Sync failed: " + result.message); |         toastService.showError("Sync failed: " + result.message); | ||||||
|  | |||||||
| @ -94,10 +94,10 @@ eventService.subscribe(eventService.CHILD_NOTE_CREATED, ({ parentNote, childNote | |||||||
| function processInverseRelations(entityName, entity, handler) { | function processInverseRelations(entityName, entity, handler) { | ||||||
|     if (entityName === 'attributes' && entity.type === 'relation') { |     if (entityName === 'attributes' && entity.type === 'relation') { | ||||||
|         const note = entity.getNote(); |         const note = entity.getNote(); | ||||||
|         const attributes = (note.getOwnedAttributes(entity.name)).filter(relation => relation.type === 'relation-definition'); |         const relDefinitions = note.getLabels('relation:' + entity.name); | ||||||
| 
 | 
 | ||||||
|         for (const attribute of attributes) { |         for (const relDefinition of relDefinitions) { | ||||||
|             const definition = attribute.value; |             const definition = relDefinition.getDefinition(); | ||||||
| 
 | 
 | ||||||
|             if (definition.inverseRelation && definition.inverseRelation.trim()) { |             if (definition.inverseRelation && definition.inverseRelation.trim()) { | ||||||
|                 const targetNote = entity.getTargetNote(); |                 const targetNote = entity.getTargetNote(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam