diff --git a/.gitignore b/.gitignore
index 3b59ff2f5..5a42acb67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,12 @@
node_modules
-npm-debug.log
+npm-debug.log*
dist
!dist/coral-admin
dist/coral-admin/bundle.js
+tests/e2e/reports
.DS_Store
*.iml
+dump.rdb
.env
gaba.cfg
.idea/
diff --git a/bin/cli-serve b/bin/cli-serve
index 0c32cbe8e..dd682f5ad 100755
--- a/bin/cli-serve
+++ b/bin/cli-serve
@@ -17,7 +17,8 @@ const util = require('../util');
/**
* Get port from environment and store in Express.
*/
-const port = normalizePort(process.env.TALK_PORT || '3000');
+
+const port = normalizePort(process.env.TALK_PORT || (process.env.NODE_ENV === 'test' ? '3011' : '3000'));
app.set('port', port);
diff --git a/client/coral-embed-stream/src/CommentStream.js b/client/coral-embed-stream/src/CommentStream.js
index 40ad72a41..0fda9444d 100644
--- a/client/coral-embed-stream/src/CommentStream.js
+++ b/client/coral-embed-stream/src/CommentStream.js
@@ -7,6 +7,7 @@ import {
Notification,
notificationActions,
authActions,
+ configActions
} from '../../coral-framework';
import CommentBox from '../../coral-plugin-commentbox/CommentBox';
@@ -21,14 +22,17 @@ import LikeButton from '../../coral-plugin-likes/LikeButton';
import PermalinkButton from '../../coral-plugin-permalinks/PermalinkButton';
import SignInContainer from '../../coral-sign-in/containers/SignInContainer';
import UserBox from '../../coral-sign-in/components/UserBox';
+
import {TabBar, Tab, TabContent, Spinner} from '../../coral-ui';
import SettingsContainer from '../../coral-settings/containers/SettingsContainer';
import RestrictedContent from '../../coral-framework/components/RestrictedContent';
import SuspendedAccount from '../../coral-framework/components/SuspendedAccount';
+import CloseCommentsInfo from '../../coral-framework/components/CloseCommentsInfo';
const {addItem, updateItem, postItem, getStream, postAction, deleteAction, appendItemArray} = itemActions;
const {addNotification, clearNotification} = notificationActions;
const {logout, showSignInDialog} = authActions;
+const {updateOpenStatus} = configActions;
class CommentStream extends Component {
@@ -40,6 +44,7 @@ class CommentStream extends Component {
};
this.changeTab = this.changeTab.bind(this);
+ this.toggleStatus = this.toggleStatus.bind(this);
}
changeTab (tab) {
@@ -48,6 +53,10 @@ class CommentStream extends Component {
});
}
+ toggleStatus () {
+ this.props.updateStatus(this.props.config.status === 'open' ? 'closed' : 'open');
+ }
+
static propTypes = {
items: PropTypes.object.isRequired,
addItem: PropTypes.func.isRequired,
@@ -56,31 +65,22 @@ class CommentStream extends Component {
componentDidMount () {
// Set up messaging between embedded Iframe an parent component
- // Using recommended Pym init code which violates .eslint standards
- const pym = new Pym.Child({polling: 100});
+ this.pym = new Pym.Child({polling: 100});
- if (/https?\:\/\/([^?]+)/.test(pym.parentUrl)) {
- this.props.getStream(pym.parentUrl);
- } else {
- this.props.getStream(window.location);
- }
+ const path = /https?\:\/\/([^?#]+)/.exec(this.pym.parentUrl);
+
+ this.props.getStream(path[1] || window.location);
+ this.path = path;
+
+ this.pym.sendMessage('childReady');
}
render () {
- if (Object.keys(this.props.items).length === 0) {
- // Loading mock asset
- this.props.postItem({
- comments: [],
- url: 'http://coralproject.net'
- }, 'asset', 'assetTest');
- }
-
- // TODO: Replace teststream id with id from params
-
const rootItemId = this.props.items.assets && Object.keys(this.props.items.assets)[0];
const rootItem = this.props.items.assets && this.props.items.assets[rootItemId];
const {actions, users, comments} = this.props.items;
const {loggedIn, user, showSignInDialog} = this.props.auth;
+ const {status} = this.props.config;
const {activeTab} = this.state;
return
@@ -90,135 +90,145 @@ class CommentStream extends Component {
Settings
+ Configure Stream
- {loggedIn && }
+ {loggedIn && }
{/* Add to the restricted param a boolean if the user is suspended*/}
}>
-
+ This comment stream is currently open. By closing this comment stream,
+ no new comments may be submitted and all previous comments will still
+ be displayed.
+
+
+
+ ) : (
+
+
+ This comment stream is currently closed. By opening this comment stream,
+ new comments may be submitted and displayed
+
+
+
+ )
+);
diff --git a/client/coral-framework/index.js b/client/coral-framework/index.js
index 7b721badc..9a679d969 100644
--- a/client/coral-framework/index.js
+++ b/client/coral-framework/index.js
@@ -4,6 +4,7 @@ import * as itemActions from './actions/items';
import I18n from './modules/i18n/i18n';
import * as notificationActions from './actions/notification';
import * as authActions from './actions/auth';
+import * as configActions from './actions/config';
export {
Notification,
@@ -12,4 +13,5 @@ export {
I18n,
notificationActions,
authActions,
+ configActions
};
diff --git a/client/coral-framework/reducers/config.js b/client/coral-framework/reducers/config.js
index 6521d92a3..9620f5b97 100644
--- a/client/coral-framework/reducers/config.js
+++ b/client/coral-framework/reducers/config.js
@@ -1,19 +1,30 @@
/* @flow */
import {Map} from 'immutable';
-import * as actions from '../actions/items';
+import * as actions from '../actions/config';
const initialState = Map({
- features: Map({})
+ features: Map({}),
+ status: 'open'
});
export default (state = initialState, action) => {
switch(action.type) {
-
// Override config if worked
case actions.UPDATE_SETTINGS:
return action.config;
+ case actions.OPEN_COMMENTS:
+ return state.set('status', 'open');
+
+ case actions.CLOSE_COMMENTS:
+ return state.set('status', 'closed');
+
+ case actions.ADD_ITEM:
+ return action.item_type === 'assets' ?
+ state.set('status', action.item.status)
+ : state;
+
default:
return state;
}
diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js
index 9ae524652..5f9592cd5 100644
--- a/client/coral-plugin-commentbox/CommentBox.js
+++ b/client/coral-plugin-commentbox/CommentBox.js
@@ -78,6 +78,7 @@ class CommentBox extends Component {
{ author && (
diff --git a/client/coral-sign-in/components/SignInContent.js b/client/coral-sign-in/components/SignInContent.js
index 395800e6c..de5e77a49 100644
--- a/client/coral-sign-in/components/SignInContent.js
+++ b/client/coral-sign-in/components/SignInContent.js
@@ -44,7 +44,7 @@ const SignInContent = ({handleChange, formData, ...props}) => (