Skip to content

Commit

Permalink
fixs the bug when cancel a pomodoro of other list than the current one
Browse files Browse the repository at this point in the history
when you try cancel a pomodoro of other list than the current one, the
task stills on the "running state"
  • Loading branch information
samuelsimoes committed Apr 9, 2017
1 parent 316cf0a commit d04f860
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/js/popup/actions/counter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export function finishItem () {

export function cancelItem () {
return function (dispatch, getStore) {
let runningItem = getStore().runningItem

dispatch({
type: actions.CANCEL_CURRENT_ITEM
})
Expand All @@ -71,6 +73,18 @@ export function cancelItem () {

runningItemRepository.persist(null)

if (runningItem &&
runningItem.type === runnableTypes.POMODORO &&
runningItem.listID !== state.currentListID) {
let list = tasksRepository.getTasks(runningItem.listID)

list = taskReducer(list, null, runningItem.id, {
type: actions.CANCEL_CURRENT_ITEM
})

tasksRepository.persistTasks(runningItem.listID, list)
}

runtimeEvents.stopBadgeCounter()
}
}

0 comments on commit d04f860

Please # to comment.