From 6098d62dcc904f61b4d7b29b99ee4915875d57a9 Mon Sep 17 00:00:00 2001 From: baiyongjie <407221377@qq.com> Date: Fri, 26 May 2023 14:36:21 +0800 Subject: [PATCH 1/2] fix getEditedNotesOnDate --- src/routes/api/note_revisions.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/routes/api/note_revisions.js b/src/routes/api/note_revisions.js index f28239f2e..e3e8bbf88 100644 --- a/src/routes/api/note_revisions.js +++ b/src/routes/api/note_revisions.js @@ -132,15 +132,17 @@ function getEditedNotesOnDate(req) { notes = notes.filter(note => note.hasAncestor(hoistedNoteId)); } - notes = notes.map(note => note.getPojo()); + const notePojos = notes.map(note => note.getPojo()); - for (const note of notes) { + notes.forEach((note, index) => { const notePath = note.isDeleted ? null : getNotePathData(note); - note.notePath = notePath ? notePath.notePath : null; - } + notePojos[index].notePath = notePath ? notePath.notePath : null; + }); - return notes; + + + return notePojos; } function getNotePathData(note) { From 9d49264258dd3f72a8f9a0e3d76af1dd02f9d663 Mon Sep 17 00:00:00 2001 From: baiyongjie <407221377@qq.com> Date: Fri, 26 May 2023 14:54:13 +0800 Subject: [PATCH 2/2] cleaup --- src/routes/api/note_revisions.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/routes/api/note_revisions.js b/src/routes/api/note_revisions.js index e3e8bbf88..53eff7165 100644 --- a/src/routes/api/note_revisions.js +++ b/src/routes/api/note_revisions.js @@ -132,17 +132,15 @@ function getEditedNotesOnDate(req) { notes = notes.filter(note => note.hasAncestor(hoistedNoteId)); } - const notePojos = notes.map(note => note.getPojo()); - - notes.forEach((note, index) => { + return notes.map(note => { const notePath = note.isDeleted ? null : getNotePathData(note); - notePojos[index].notePath = notePath ? notePath.notePath : null; + const notePojo = note.getPojo(); + notePojo.notePath = notePath ? notePath.notePath : null; + + return notePojo; }); - - - return notePojos; } function getNotePathData(note) {