mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix notePosition assignment for new children of root
This commit is contained in:
parent
691fccb769
commit
5905950c17
1
db/migrations/0214__fix_root_children_ordering.sql
Normal file
1
db/migrations/0214__fix_root_children_ordering.sql
Normal file
@ -0,0 +1 @@
|
||||
UPDATE branches SET notePosition = notePosition - 999899999 WHERE parentNoteId = 'root' AND notePosition > 999999999;
|
@ -4,7 +4,7 @@ const build = require('./build');
|
||||
const packageJson = require('../../package');
|
||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||
|
||||
const APP_DB_VERSION = 213;
|
||||
const APP_DB_VERSION = 214;
|
||||
const SYNC_VERSION = 29;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
|
@ -26,11 +26,13 @@ const fs = require("fs");
|
||||
function getNewNotePosition(parentNote) {
|
||||
if (parentNote.isLabelTruthy('newNotesOnTop')) {
|
||||
const minNotePos = parentNote.getChildBranches()
|
||||
.filter(branch => branch.noteId !== '_hidden') // has "always last" note position
|
||||
.reduce((min, note) => Math.min(min, note.notePosition), 0);
|
||||
|
||||
return minNotePos - 10;
|
||||
} else {
|
||||
const maxNotePos = parentNote.getChildBranches()
|
||||
.filter(branch => branch.noteId !== '_hidden') // has "always last" note position
|
||||
.reduce((max, note) => Math.max(max, note.notePosition), 0);
|
||||
|
||||
return maxNotePos + 10;
|
||||
|
Loading…
x
Reference in New Issue
Block a user