diff --git a/src/actions/editorialWorkflow.js b/src/actions/editorialWorkflow.js index 36187bdf..32322840 100644 --- a/src/actions/editorialWorkflow.js +++ b/src/actions/editorialWorkflow.js @@ -3,8 +3,6 @@ import { EDITORIAL_WORKFLOW } from '../constants/publishModes'; /* * Contant Declarations */ -export const INIT = 'init'; - export const UNPUBLISHED_ENTRY_REQUEST = 'UNPUBLISHED_ENTRY_REQUEST'; export const UNPUBLISHED_ENTRY_SUCCESS = 'UNPUBLISHED_ENTRY_SUCCESS'; @@ -55,16 +53,6 @@ function unpublishedEntriesFailed(error) { }; } -/* - * Exported simple Action Creators - */ -export function init() { - return { - type: INIT - }; -} - - /* * Exported Thunk Action Creators */ diff --git a/src/containers/editorialWorkflow/CollectionPageHOC.js b/src/containers/editorialWorkflow/CollectionPageHOC.js index 590e1fb1..4894e79a 100644 --- a/src/containers/editorialWorkflow/CollectionPageHOC.js +++ b/src/containers/editorialWorkflow/CollectionPageHOC.js @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { OrderedMap } from 'immutable'; -import { init, loadUnpublishedEntries } from '../../actions/editorialWorkflow'; +import { loadUnpublishedEntries } from '../../actions/editorialWorkflow'; import { selectUnpublishedEntries } from '../../reducers'; import { EDITORIAL_WORKFLOW, status } from '../../constants/publishModes'; import UnpublishedListing from '../../components/UnpublishedListing'; @@ -13,7 +13,6 @@ export default function CollectionPageHOC(CollectionPage) { componentDidMount() { const { dispatch, isEditorialWorkflow } = this.props; if (isEditorialWorkflow) { - dispatch(init()); dispatch(loadUnpublishedEntries()); } super.componentDidMount(); diff --git a/src/reducers/editorialWorkflow.js b/src/reducers/editorialWorkflow.js index 81bdc980..beee2071 100644 --- a/src/reducers/editorialWorkflow.js +++ b/src/reducers/editorialWorkflow.js @@ -1,14 +1,20 @@ import { Map, List, fromJS } from 'immutable'; +import { EDITORIAL_WORKFLOW } from '../constants/publishModes'; import { - INIT, UNPUBLISHED_ENTRY_REQUEST, UNPUBLISHED_ENTRY_SUCCESS, UNPUBLISHED_ENTRIES_REQUEST, UNPUBLISHED_ENTRIES_SUCCESS + UNPUBLISHED_ENTRY_REQUEST, UNPUBLISHED_ENTRY_SUCCESS, UNPUBLISHED_ENTRIES_REQUEST, UNPUBLISHED_ENTRIES_SUCCESS } from '../actions/editorialWorkflow'; +import { CONFIG_SUCCESS } from '../actions/config'; const unpublishedEntries = (state = null, action) => { switch (action.type) { - case INIT: - // Editorial workflow must be explicitly initiated. - return Map({ entities: Map(), pages: Map() }); - + case CONFIG_SUCCESS: + const publish_mode = action.payload && action.payload.publish_mode; + if (publish_mode === EDITORIAL_WORKFLOW) { + // Editorial workflow state is explicetelly initiated after the config. + return Map({ entities: Map(), pages: Map() }); + } else { + return state; + } case UNPUBLISHED_ENTRY_REQUEST: return state.setIn(['entities', `${action.payload.status}.${action.payload.slug}`, 'isFetching'], true);