mirror of
https://github.com/wassname/talk.git
synced 2026-07-07 10:25:04 +08:00
Routes taking :id
This commit is contained in:
@@ -35,7 +35,9 @@ const routes = (
|
||||
{/* Moderation Routes */}
|
||||
|
||||
<Route path='moderate' component={ModerationLayout}>
|
||||
<IndexRoute component={Moderation} />
|
||||
<Route path=':id' components={Moderation} />
|
||||
<IndexRedirect to=':id' />
|
||||
|
||||
<Route path='all' components={Moderation}>
|
||||
<Route path=':id' components={Moderation} />
|
||||
</Route>
|
||||
|
||||
@@ -83,14 +83,7 @@ export default class Moderation extends Component {
|
||||
}
|
||||
|
||||
getComments = () => {
|
||||
const {root, root: {asset, settings}, router, route} = this.props;
|
||||
|
||||
// Grab premod from asset or from settings
|
||||
const premod = !router.params.id ? settings.moderation : asset.settings.moderation;
|
||||
|
||||
const queue = isPremod(premod) ? 'premod' : 'new';
|
||||
const activeTab = router.params.id ? queue : route.path;
|
||||
|
||||
const {activeTab} = this.props;
|
||||
return root[activeTab].nodes;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import t from 'coral-framework/services/i18n';
|
||||
import update from 'immutability-helper';
|
||||
import truncate from 'lodash/truncate';
|
||||
import NotFoundAsset from '../components/NotFoundAsset';
|
||||
import {getModPath} from '../../../utils';
|
||||
import {isPremod, getModPath} from '../../../utils';
|
||||
|
||||
import {withSetCommentStatus} from 'coral-framework/graphql/mutations';
|
||||
import {handleCommentChange} from '../../../graphql/utils';
|
||||
@@ -39,8 +39,16 @@ class ModerationContainer extends Component {
|
||||
subscriptions = [];
|
||||
|
||||
get activeTab() {
|
||||
const {route} = this.props;
|
||||
return route.path === ':id' ? 'new' : route.path;
|
||||
|
||||
const {root: {asset, settings}, router, route} = this.props;
|
||||
|
||||
// Grab premod from asset or from settings
|
||||
const premod = !router.params.id ? settings.moderation : asset.settings.moderation;
|
||||
|
||||
const queue = isPremod(premod) ? 'premod' : 'new';
|
||||
const activeTab = router.params.id ? queue : route.path;
|
||||
|
||||
return activeTab;
|
||||
}
|
||||
|
||||
subscribeToUpdates(variables = this.props.data.variables) {
|
||||
|
||||
Reference in New Issue
Block a user