trigger events after note attributes are created

This commit is contained in:
azivner 2018-10-08 11:09:45 +02:00
parent 24673168bb
commit be94766f76
2 changed files with 4 additions and 3 deletions

View File

@ -30,6 +30,7 @@ eventService.subscribe(eventService.NOTE_TITLE_CHANGED, async note => {
await treeService.sortNotesAlphabetically(parent.noteId); await treeService.sortNotesAlphabetically(parent.noteId);
messagingService.sendMessageToAllClients({ type: 'refresh-tree' }); messagingService.sendMessageToAllClients({ type: 'refresh-tree' });
break; // sending the message once is enough
} }
} }
} }

View File

@ -68,9 +68,6 @@ async function createNewNote(parentNoteId, noteData) {
isExpanded: 0 isExpanded: 0
}).save(); }).save();
await triggerNoteTitleChanged(note);
await triggerChildNoteCreated(note, parentNote);
for (const attr of await parentNote.getAttributes()) { for (const attr of await parentNote.getAttributes()) {
if (attr.name.startsWith("child:")) { if (attr.name.startsWith("child:")) {
await new Attribute({ await new Attribute({
@ -86,6 +83,9 @@ async function createNewNote(parentNoteId, noteData) {
} }
} }
await triggerNoteTitleChanged(note);
await triggerChildNoteCreated(note, parentNote);
return { return {
note, note,
branch branch