diff --git a/client/coral-admin/src/routes/Moderation/components/Moderation.js b/client/coral-admin/src/routes/Moderation/components/Moderation.js index 851dc51de..ca49f0efd 100644 --- a/client/coral-admin/src/routes/Moderation/components/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/components/Moderation.js @@ -7,7 +7,7 @@ import ModerationMenu from './ModerationMenu'; import ModerationHeader from './ModerationHeader'; import ModerationKeysModal from '../../../components/ModerationKeysModal'; import StorySearch from '../containers/StorySearch'; -import {isPremod, getModPath} from '../../../utils'; +import {isPremod} from '../../../utils'; export default class Moderation extends Component { constructor() { @@ -104,7 +104,7 @@ export default class Moderation extends Component { const {root, moderation, settings, viewUserDetail, hideUserDetail, activeTab, getModPath, ...props} = this.props; const assetId = this.props.params.id; const {asset} = root; - console.log(activeTab) + const comments = root[activeTab]; let activeTabCount; diff --git a/client/coral-admin/src/routes/Moderation/containers/Moderation.js b/client/coral-admin/src/routes/Moderation/containers/Moderation.js index c475e5037..77a2f652b 100644 --- a/client/coral-admin/src/routes/Moderation/containers/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/containers/Moderation.js @@ -141,21 +141,38 @@ class ModerationContainer extends Component { componentWillReceiveProps(nextProps) { + // Will update the URL to `premod` or `new` based on the moderation of the *asset* + // If there are a reported comments, the `reported` queue has priority! + + if (nextProps.root) { + const {router, route, root} = nextProps; + + if (router.location.pathname === 'admin/moderate' && root.settings) { + const queue = isPremod(root.settings.moderation) ? 'premod' : 'new'; + + console.log('PUSHING ROUTE', getModPath(root.reportedCount ? 'reported' : queue)); + + router.push( + getModPath(root.reportedCount ? 'reported' : queue) + ); + } + + if (route.path === ':id' && root.asset) { + console.log(root.asset.settings.moderation) + const queue = isPremod(root.asset.settings.moderation) ? 'premod' : 'new'; + + console.log('PUSHING ROUTE', getModPath(root.reportedCount ? 'reported' : queue)); + + router.push( + getModPath(root.reportedCount ? 'reported' : queue, router.params.id) + ); + } + } + // Resubscribe when we change between assets. if(this.props.data.variables.asset_id !== nextProps.data.variables.asset_id) { this.resubscribe(nextProps.data.variables); } - - // const {router, route, root: {asset, reportedCount}} = this.props; - - // // Will update the URL to premod or new based on the moderation of the *asset* - // // If there is a reported comments, reported queue has priority! - // if (route.path === ':id') { - // const queue = isPremod(asset.settings.moderation) ? 'premod' : 'new'; - // router.push( - // getModPath(reportedCount ? 'reported' : queue, asset.id) - // ); - // } } acceptComment = ({commentId}) => {