diff --git a/.nodemon.json b/.nodemon.json
index 4289167f7..4c48c707e 100644
--- a/.nodemon.json
+++ b/.nodemon.json
@@ -1,4 +1,5 @@
{
"verbose": true,
- "ignore": ["test/*", "client/*", "dist/*"]
+ "ignore": ["test/*", "client/*", "dist/*"],
+ "ext": "js,json,graphql"
}
diff --git a/client/coral-configure/components/ConfigureCommentStream.js b/client/coral-configure/components/ConfigureCommentStream.js
index 507c764d7..bf4ebe3e6 100644
--- a/client/coral-configure/components/ConfigureCommentStream.js
+++ b/client/coral-configure/components/ConfigureCommentStream.js
@@ -7,47 +7,50 @@ 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')}
+
+
+
+ -
+
+ {/* To be implimented
+
+ */}
+
+
+
+
+
);
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/Comment.js b/client/coral-embed-stream/src/Comment.js
index f734bce0b..93c89ffb0 100644
--- a/client/coral-embed-stream/src/Comment.js
+++ b/client/coral-embed-stream/src/Comment.js
@@ -26,6 +26,11 @@ class Comment extends React.Component {
}
static propTypes = {
+ reactKey: PropTypes.string.isRequired,
+
+ // id of currently opened ReplyBox. tracked in Stream.js
+ activeReplyBox: PropTypes.string.isRequired,
+ setActiveReplyBox: PropTypes.func.isRequired,
refetch: PropTypes.func.isRequired,
showSignInDialog: PropTypes.func.isRequired,
postAction: PropTypes.func.isRequired,
@@ -60,15 +65,6 @@ class Comment extends React.Component {
}).isRequired
}
- onReplyBoxClick = () => {
- if (this.props.currentUser) {
- this.setState({replyBoxVisible: !this.state.replyBoxVisible});
- } else {
- const offset = document.getElementById(`c_${this.props.comment.id}`).getBoundingClientRect().top - 75;
- this.props.showSignInDialog(offset);
- }
- }
-
render () {
const {
comment,
@@ -81,6 +77,8 @@ class Comment extends React.Component {
addNotification,
showSignInDialog,
postAction,
+ setActiveReplyBox,
+ activeReplyBox,
deleteAction
} = this.props;
@@ -106,7 +104,7 @@ class Comment extends React.Component {
setActiveReplyBox(comment.id)}
parentCommentId={parentId || comment.id}
currentUserId={currentUser && currentUser.id}
banned={false} />
@@ -130,13 +128,13 @@ class Comment extends React.Component {
{
- this.state.replyBoxVisible
+ activeReplyBox === comment.id
?
{
- console.log('replyPostedHandler');
- this.setState({replyBoxVisible: false});
+ setActiveReplyBox('');
refetch();
}}
+ setActiveReplyBox={setActiveReplyBox}
parentId={parentId || comment.id}
addNotification={addNotification}
authorId={currentUser.id}
@@ -149,6 +147,8 @@ class Comment extends React.Component {
comment.replies.map(reply => {
return ;
})
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
?