launchbar WIP

This commit is contained in:
zadam
2022-08-06 15:00:56 +02:00
parent 54900b35dc
commit 08aa65bddb
13 changed files with 71 additions and 53 deletions

View File

@@ -4,6 +4,8 @@ const treeService = require('./tree');
const noteService = require('./notes');
const becca = require('../becca/becca');
const Attribute = require('../becca/entities/attribute');
const debounce = require('debounce');
const specialNotesService = require("./special_notes");
function runAttachedRelations(note, relationName, originEntity) {
if (!note) {
@@ -160,6 +162,8 @@ eventService.subscribe(eventService.ENTITY_CHANGED, ({ entityName, entity }) =>
});
});
const debouncedCreateMissingSpecialNotes = debounce(() => specialNotesService.createMissingSpecialNotes(), 300);
eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) => {
processInverseRelations(entityName, entity, (definition, note, targetNote) => {
// if one inverse attribute is deleted then the other should be deleted as well
@@ -175,6 +179,13 @@ eventService.subscribe(eventService.ENTITY_DELETED, ({ entityName, entity }) =>
if (entityName === 'branches') {
runAttachedRelations(entity.getNote(), 'runOnBranchDeletion', entity);
}
if (entityName === 'notes') {
if (entity.noteId.startsWith("lb_")) {
// if user deletes shortcuts, restore them immediately
debouncedCreateMissingSpecialNotes();
}
}
});
module.exports = {