more relation events, events are now not triggered on sync changes

This commit is contained in:
azivner
2018-08-15 22:06:49 +02:00
parent df9acd0504
commit 0f106fb96f
8 changed files with 117 additions and 55 deletions

View File

@@ -228,13 +228,13 @@ function getNotePath(noteId) {
}
}
eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entityId}) => {
eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entity}) => {
if (!loaded) {
return;
}
if (entityName === 'notes') {
const note = await repository.getNote(entityId);
const note = entity;
if (note.isDeleted) {
delete noteTitles[note.noteId];
@@ -245,7 +245,7 @@ eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entityId
}
}
else if (entityName === 'branches') {
const branch = await repository.getBranch(entityId);
const branch = entity;
if (childToParent[branch.noteId]) {
childToParent[branch.noteId] = childToParent[branch.noteId].filter(noteId => noteId !== branch.parentNoteId)
@@ -266,7 +266,7 @@ eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entityId
}
}
else if (entityName === 'attributes') {
const attribute = await repository.getAttribute(entityId);
const attribute = entity;
if (attribute.type === 'label' && attribute.name === 'archived') {
// we're not using label object directly, since there might be other non-deleted archived label