Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove updateFolder because it's no longer used
  • Loading branch information
asmsuechan committed Oct 13, 2017
commit 9bca133d8899de9d567820f183191c3c686dcd25
27 changes: 5 additions & 22 deletions browser/main/NoteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down