fix import uuid change, export all items
This commit is contained in:
@@ -121,6 +121,14 @@ class Item {
|
||||
_.merge(this, _.omit(item, ["content"]));
|
||||
}
|
||||
|
||||
informReferencesOfUUIDChange(oldUUID, newUUID) {
|
||||
// optional override
|
||||
}
|
||||
|
||||
potentialItemOfInterestHasChangedItsUUID(newItem, oldUUID, newUUID) {
|
||||
// optional override
|
||||
}
|
||||
|
||||
allReferencedObjects() {
|
||||
// must override
|
||||
return [];
|
||||
|
||||
@@ -66,6 +66,13 @@ class Editor extends Item {
|
||||
this.notes = [];
|
||||
}
|
||||
|
||||
potentialItemOfInterestHasChangedItsUUID(newItem, oldUUID, newUUID) {
|
||||
if(newItem.content_type === "Note" && _.find(this.notes, {uuid: oldUUID})) {
|
||||
_.pull(this.notes, {uuid: oldUUID});
|
||||
this.notes.push(newItem);
|
||||
}
|
||||
}
|
||||
|
||||
allReferencedObjects() {
|
||||
return this.notes;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,13 @@ class Note extends Item {
|
||||
return filtered;
|
||||
}
|
||||
|
||||
informReferencesOfUUIDChange(oldUUID, newUUID) {
|
||||
for(var tag of this.tags) {
|
||||
_.pull(tag.notes, {uuid: oldUUID});
|
||||
tag.notes.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
allReferencedObjects() {
|
||||
return this.tags;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,13 @@ class Tag extends Item {
|
||||
super.isBeingRemovedLocally();
|
||||
}
|
||||
|
||||
informReferencesOfUUIDChange(oldUUID, newUUID) {
|
||||
for(var note of this.notes) {
|
||||
_.pull(note.tags, {uuid: oldUUID});
|
||||
note.tags.push(this);
|
||||
}
|
||||
}
|
||||
|
||||
get content_type() {
|
||||
return "Tag";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user