Skip to content

Commit

Permalink
fix(manager/actions/status): Navigate to latest feed ver. after proce…
Browse files Browse the repository at this point in the history
…ssing complete.
  • Loading branch information
binh-dam-ibigroup committed Mar 2, 2021
1 parent efeae58 commit eb648f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/manager/actions/status.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow

import moment from 'moment'
import { browserHistory } from 'react-router'
import { createAction, type ActionType } from 'redux-actions'

import { createVoidPayloadAction, secureFetch } from '../../common/actions'
Expand Down Expand Up @@ -259,6 +260,17 @@ export function handleFinishedJob (job: ServerJob) {
}
}
break
case 'PROCESS_FEED':
// If viewing a particular feed, navigate to a new feed version as soon as it becomes available.
// It is the same path (without version number) as the link shown for this job status.
// (If user is not looking at this feed, don't navigate away from their current page.)
if (job.feedSourceId) {
const newVersionPath = `/feed/${job.feedSourceId}`
if (browserHistory.getCurrentLocation().pathname.startsWith(newVersionPath)) {
browserHistory.push(newVersionPath)
}
}
break
default:
console.warn(`No completion step defined for job type ${job.type}`)
break
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/actions/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function publishFeedVersion (feedVersion: FeedVersion) {
}

/**
* Merges two feed versions according to the strategy defined within the
* Merges two feed versions according to the strategy defined by the mergeType parameter.
*/
export function mergeVersions (targetVersionId: string, versionId: string, mergeType: 'SERVICE_PERIOD' | 'REGIONAL') {
return function (dispatch: dispatchFn, getState: getStateFn) {
Expand Down

0 comments on commit eb648f9

Please # to comment.