mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
got rid of "origParentNoteId" since it's not needed anymore
This commit is contained in:
parent
88213c1bbd
commit
976b2aa6f5
@ -28,13 +28,6 @@ class Branch extends Entity {
|
|||||||
// notePosition is not part of hash because it would produce a lot of updates in case of reordering
|
// notePosition is not part of hash because it would produce a lot of updates in case of reordering
|
||||||
static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "isDeleted", "deleteId", "prefix"]; }
|
static get hashedProperties() { return ["branchId", "noteId", "parentNoteId", "isDeleted", "deleteId", "prefix"]; }
|
||||||
|
|
||||||
constructor(row = {}) {
|
|
||||||
super(row);
|
|
||||||
|
|
||||||
// used to detect move in note tree
|
|
||||||
this.origParentNoteId = this.parentNoteId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @returns {Note|null} */
|
/** @returns {Note|null} */
|
||||||
async getNote() {
|
async getNote() {
|
||||||
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
return await repository.getEntity("SELECT * FROM notes WHERE noteId = ?", [this.noteId]);
|
||||||
@ -65,12 +58,6 @@ class Branch extends Entity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// cannot be static!
|
|
||||||
updatePojo(pojo) {
|
|
||||||
// FIXME remove
|
|
||||||
delete pojo.origParentNoteId;
|
|
||||||
}
|
|
||||||
|
|
||||||
createClone(parentNoteId, notePosition) {
|
createClone(parentNoteId, notePosition) {
|
||||||
return new Branch({
|
return new Branch({
|
||||||
noteId: this.noteId,
|
noteId: this.noteId,
|
||||||
|
@ -477,14 +477,14 @@ eventService.subscribe([eventService.ENTITY_CHANGED, eventService.ENTITY_DELETED
|
|||||||
else if (entityName === 'branches') {
|
else if (entityName === 'branches') {
|
||||||
const branch = entity;
|
const branch = entity;
|
||||||
|
|
||||||
// first we remove records for original placement (if they exist)
|
if (branch.isDeleted) {
|
||||||
childToParent[branch.noteId] = childToParent[branch.noteId] || [];
|
childToParent[branch.noteId] = childToParent[branch.noteId] || [];
|
||||||
childToParent[branch.noteId] = childToParent[branch.noteId].filter(noteId => noteId !== branch.origParentNoteId);
|
childToParent[branch.noteId] = childToParent[branch.noteId].filter(noteId => noteId !== branch.parentNoteId);
|
||||||
|
|
||||||
delete prefixes[branch.noteId + '-' + branch.origParentNoteId];
|
delete prefixes[branch.noteId + '-' + branch.parentNoteId];
|
||||||
delete childParentToBranchId[branch.noteId + '-' + branch.origParentNoteId];
|
delete childParentToBranchId[branch.noteId + '-' + branch.parentNoteId];
|
||||||
|
}
|
||||||
if (!branch.isDeleted) {
|
else {
|
||||||
// ... and then we create new records
|
// ... and then we create new records
|
||||||
if (branch.prefix) {
|
if (branch.prefix) {
|
||||||
prefixes[branch.noteId + '-' + branch.parentNoteId] = branch.prefix;
|
prefixes[branch.noteId + '-' + branch.parentNoteId] = branch.prefix;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user