fix inverse relation creation, closes #1498

This commit is contained in:
zadam 2020-12-21 20:55:01 +01:00
parent b093569ec5
commit eaf93a70cd
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ async function syncNow() {
}
else {
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);

View File

@ -94,10 +94,10 @@ eventService.subscribe(eventService.CHILD_NOTE_CREATED, ({ parentNote, childNote
function processInverseRelations(entityName, entity, handler) {
if (entityName === 'attributes' && entity.type === 'relation') {
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) {
const definition = attribute.value;
for (const relDefinition of relDefinitions) {
const definition = relDefinition.getDefinition();
if (definition.inverseRelation && definition.inverseRelation.trim()) {
const targetNote = entity.getTargetNote();