diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 4a67abeb..76d089cc 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -548,11 +548,9 @@ class NoteList extends React.Component { }) if (dialogueButtonIndex === 1) return Promise.all( - selectedNoteKeys.map((uniqueKey) => { - const storageKey = uniqueKey.split('-')[0] - const noteKey = uniqueKey.split('-')[1] + selectedNotes.map((note) => { return dataApi - .deleteNote(storageKey, noteKey) + .deleteNote(note.storage, note.key) }) ) .then((data) => { diff --git a/browser/main/SideNav/index.js b/browser/main/SideNav/index.js index 6d05e37b..6205300e 100644 --- a/browser/main/SideNav/index.js +++ b/browser/main/SideNav/index.js @@ -148,10 +148,8 @@ class SideNav extends React.Component { emptyTrash (entries) { const { dispatch } = this.props - const deletionPromises = entries.map((storageAndNoteKey) => { - const storageKey = storageAndNoteKey.split('-')[0] - const noteKey = storageAndNoteKey.split('-')[1] - return dataApi.deleteNote(storageKey, noteKey) + const deletionPromises = entries.map((note) => { + return dataApi.deleteNote(note.storage, note.key) }) Promise.all(deletionPromises) .then((arrayOfStorageAndNoteKeys) => { @@ -167,9 +165,9 @@ class SideNav extends React.Component { handleFilterButtonContextMenu (event) { const { data } = this.props - const entries = data.trashedSet.toJS() + const trashedNotes = data.trashedSet.toJS().map((uniqueKey) => data.noteMap.get(uniqueKey)) const menu = Menu.buildFromTemplate([ - { label: 'Empty Trash', click: () => this.emptyTrash(entries) } + { label: 'Empty Trash', click: () => this.emptyTrash(trashedNotes) } ]) menu.popup() } diff --git a/browser/main/store.js b/browser/main/store.js index 1ee9fc88..f078ad20 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -297,7 +297,7 @@ function data (state = defaultDataMap(), action) { } case 'DELETE_NOTE': { - const uniqueKey = action.storageKey + '-' + action.noteKey + const uniqueKey = action.noteKey const targetNote = state.noteMap.get(uniqueKey) state = Object.assign({}, state)