From 9bca133d8899de9d567820f183191c3c686dcd25 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 13 Oct 2017 14:12:50 +0900 Subject: [PATCH] Remove updateFolder because it's no longer used --- browser/main/NoteList/index.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 54e0d87a..2201f4f2 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -386,32 +386,15 @@ class NoteList extends React.Component { } pinToTop (e, uniqueKey) { - const { data, location } = this.props - let splitted = location.pathname.split('/') - const storageKey = splitted[2] - const folderKey = splitted[4] + const { data, params } = this.props + const storageKey = params.storageKey + const folderKey = params.folderKey const currentStorage = data.storageMap.get(storageKey) const currentFolder = _.find(currentStorage.folders, {key: folderKey}) - dataApi - .updateFolder(storageKey, folderKey, { - color: currentFolder.color, - name: currentFolder.name, - pinnedNote: uniqueKey.split('-').pop() - }) - .then((data) => { - store.dispatch({ - type: 'UPDATE_FOLDER', - storage: data.storage - }) - this.setState({ - status: 'IDLE' - }) - }) - - let targetIndex = _.findIndex(this.notes, (note) => { - return note != null && note.storage + '-' + note.key === uniqueKey + const targetIndex = _.findIndex(this.notes, (note) => { + return note != null && `${note.storage}-${note.key}` === uniqueKey }) let note = this.notes[targetIndex] note.isPinned = !note.isPinned