diff --git a/client/coral-configure/components/ConfigureCommentStream.js b/client/coral-configure/components/ConfigureCommentStream.js
index 507c764d7..e8978a713 100644
--- a/client/coral-configure/components/ConfigureCommentStream.js
+++ b/client/coral-configure/components/ConfigureCommentStream.js
@@ -7,47 +7,47 @@ import translations from '../translations.json';
const lang = new I18n(translations);
export default ({handleChange, handleApply, changed, ...props}) => (
-
-
-
{lang.t('configureCommentStream.title')}
-
{lang.t('configureCommentStream.description')}
-
-
-
- -
-
+
+
+
{lang.t('configureCommentStream.title')}
+
{lang.t('configureCommentStream.description')}
+
-
-
-
-
+ cStyle={changed ? 'green' : 'darkGrey'} >
+ {lang.t('configureCommentStream.apply')}
+
+
+
+
+
);
diff --git a/client/coral-configure/containers/ConfigureStreamContainer.js b/client/coral-configure/containers/ConfigureStreamContainer.js
index 90835ab3f..dfe94de42 100644
--- a/client/coral-configure/containers/ConfigureStreamContainer.js
+++ b/client/coral-configure/containers/ConfigureStreamContainer.js
@@ -1,8 +1,9 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
+import {compose} from 'react-apollo';
-import {I18n} from '../../coral-framework';
-import {updateOpenStatus, updateConfiguration} from '../../coral-framework/actions/asset';
+import {I18n} from 'coral-framework';
+import {updateOpenStatus, updateConfiguration} from 'coral-framework/actions/asset';
import CloseCommentsInfo from '../components/CloseCommentsInfo';
import ConfigureCommentStream from '../components/ConfigureCommentStream';
@@ -13,11 +14,8 @@ class ConfigureStreamContainer extends Component {
constructor (props) {
super(props);
- console.log('moderation', props.asset.settings.moderation);
-
this.state = {
- premod: props.asset.settings.moderation === 'PRE',
- premodLinks: false
+ changed: false
};
this.toggleStatus = this.toggleStatus.bind(this);
@@ -25,11 +23,18 @@ class ConfigureStreamContainer extends Component {
this.handleApply = this.handleApply.bind(this);
}
- handleApply () {
- const {premod, changed} = this.state;
+ handleApply (e) {
+ e.preventDefault();
+ const {elements} = e.target;
+ const premod = elements.premod.checked;
+
+ // const premodLinks = elements.premodLinks.checked;
+ const {changed} = this.state;
+
const newConfig = {
moderation: premod ? 'PRE' : 'POST'
};
+
if (changed) {
this.props.updateConfiguration(newConfig);
setTimeout(() => {
@@ -40,16 +45,16 @@ class ConfigureStreamContainer extends Component {
}
}
- handleChange (e) {
- const {name, checked} = e.target;
+ handleChange () {
this.setState({
- [name]: checked,
changed: true
});
}
toggleStatus () {
- this.props.updateStatus(this.props.asset.closedAt === null ? 'closed' : 'open');
+ this.props.updateStatus(
+ this.props.asset.closedAt === null ? 'closed' : 'open'
+ );
}
getClosedIn () {
@@ -60,13 +65,16 @@ class ConfigureStreamContainer extends Component {
render () {
const status = this.props.asset.closedAt === null ? 'open' : 'closed';
+ const premod = this.props.asset.settings.moderation === 'PRE';
+
return (
{status === 'open' ? 'Close' : 'Open'} Comment Stream
@@ -89,7 +97,6 @@ const mapDispatchToProps = dispatch => ({
updateConfiguration: newConfig => dispatch(updateConfiguration(newConfig))
});
-export default connect(
- mapStateToProps,
- mapDispatchToProps
+export default compose(
+ connect(mapStateToProps, mapDispatchToProps)
)(ConfigureStreamContainer);
diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js
index 5922266fa..416c7fef8 100644
--- a/client/coral-embed-stream/src/Embed.js
+++ b/client/coral-embed-stream/src/Embed.js
@@ -9,8 +9,8 @@ const {logout, showSignInDialog} = authActions;
const {addNotification, clearNotification} = notificationActions;
const {fetchAssetSuccess} = assetActions;
-import {queryStream} from './graphql/queries';
-import {postComment, postAction, deleteAction} from './graphql/mutations';
+import {queryStream} from 'coral-framework/graphql/queries';
+import {postComment, postAction, deleteAction} from 'coral-framework/graphql/mutations';
import {Notification, notificationActions, authActions, assetActions, pym} from 'coral-framework';
import Stream from './Stream';
@@ -90,9 +90,12 @@ class Embed extends Component {
render () {
const {activeTab} = this.state;
+ const {closedAt} = this.props.asset;
const {loading, asset, refetch} = this.props.data;
const {loggedIn, isAdmin, user, showSignInDialog, signInOffset} = this.props.auth;
+ const openStream = closedAt === null;
+
const expandForLogin = showSignInDialog ? {
minHeight: document.body.scrollHeight + 200
} : {};
@@ -109,7 +112,7 @@ class Embed extends Component {
{loggedIn && }
{
- asset.closedAt === null
+ openStream
?