diff --git a/.gitignore b/.gitignore index 98dc70fc5..3e0ebbe70 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ tests/e2e/reports *.iml .env* gaba.cfg +.idea/ diff --git a/TERMINOLOGY.md b/TERMINOLOGY.md index 5c1e9aaa8..b95dbb816 100644 --- a/TERMINOLOGY.md +++ b/TERMINOLOGY.md @@ -32,7 +32,7 @@ This is a guide to have a common language to talk about "Talk". * Protected Profile: information about users that only moderators and admins can see * Queue - Group of items based on a query, aka - moderation queue -* Target - The item/s on which an action is performed.. +* Target - The item/s on which an action is performed ## Actions @@ -64,3 +64,10 @@ Postmoderation means that comments appear on the site _before_ any moderation ac * New comments appear in comment streams immediately. * New comments do not appear in moderation queues unless they are flagged by other users. + +### Word lists + +* Banned words - words that the site never allows in a comment +* Suspect words - words whose usage needs to be approved by a moderator before being shown in the stream +* Approved words - words that are usually Banned or Suspect sitewide, but approved for use in a specific article stream + diff --git a/app.js b/app.js index 6512680aa..8008cb01e 100644 --- a/app.js +++ b/app.js @@ -21,7 +21,7 @@ if (app.get('env') !== 'test') { // APP MIDDLEWARE //============================================================================== -app.set('trust proxy', 'loopback'); +app.set('trust proxy', 1); app.use(helmet()); app.use(bodyParser.json()); app.use('/client', express.static(path.join(__dirname, 'dist'))); @@ -97,7 +97,7 @@ app.use('/api', (err, req, res, next) => { res.status(err.status || 500); res.json({ message: err.message, - error: app.get('env') === 'development' ? err : null + error: app.get('env') === 'development' ? err : {} }); }); @@ -109,7 +109,7 @@ app.use('/', (err, req, res, next) => { res.status(err.status || 500); res.render('error', { message: err.message, - error: app.get('env') === 'development' ? err : null + error: app.get('env') === 'development' ? err : {} }); }); diff --git a/bin/www b/bin/www index 792a6b98a..3e9e20918 100755 --- a/bin/www +++ b/bin/www @@ -13,33 +13,30 @@ process.env.DEBUG = process.env.TALK_DEBUG; const app = require('../app'); const debug = require('debug')('talk:server'); const http = require('http'); -const initPromise = require('../init'); +const init = require('../init'); const port = normalizePort(process.env.TALK_PORT || '3000'); let server; -initPromise - .then(() => { - /** - * Get port from environment and store in Express. - */ +init().then(() => { - app.set('port', port); + /** + * Get port from environment and store in Express. + */ + app.set('port', port); - /** - * Create HTTP server. - */ + /** + * Create HTTP server. + */ + server = http.createServer(app); - server = http.createServer(app); - - /** - * Listen on provided port, on all network interfaces. - */ - - server.listen(port); - server.on('error', onError); - server.on('listening', onListening); - }); + /** + * Listen on provided port, on all network interfaces. + */ + server.listen(port); + server.on('error', onError); + server.on('listening', onListening); +}); /** * Normalize a port into a number, string, or false. diff --git a/client/coral-admin/src/AppRouter.js b/client/coral-admin/src/AppRouter.js index 5d21fc819..a0b43361d 100644 --- a/client/coral-admin/src/AppRouter.js +++ b/client/coral-admin/src/AppRouter.js @@ -8,7 +8,7 @@ import CommunityContainer from 'containers/Community/CommunityContainer'; import LayoutContainer from 'containers/LayoutContainer'; const routes = ( - + diff --git a/client/coral-admin/src/actions/auth.js b/client/coral-admin/src/actions/auth.js new file mode 100644 index 000000000..c5a03132f --- /dev/null +++ b/client/coral-admin/src/actions/auth.js @@ -0,0 +1,19 @@ +import * as actions from '../constants/auth'; +import {base, handleResp, getInit} from '../helpers/response'; + +// Check Login + +const checkLoginRequest = () => ({type: actions.CHECK_LOGIN_REQUEST}); +const checkLoginSuccess = (user, isAdmin) => ({type: actions.CHECK_LOGIN_SUCCESS, user, isAdmin}); +const checkLoginFailure = error => ({type: actions.CHECK_LOGIN_FAILURE, error}); + +export const checkLogin = () => dispatch => { + dispatch(checkLoginRequest()); + fetch(`${base}/auth`, getInit('GET')) + .then(handleResp) + .then(user => { + const isAdmin = !!user.roles.filter(i => i === 'admin').length; + dispatch(checkLoginSuccess(user, isAdmin)); + }) + .catch(error => dispatch(checkLoginFailure(error))); +}; diff --git a/client/coral-admin/src/components/Comment.js b/client/coral-admin/src/components/Comment.js index 154d68134..80c67aebd 100644 --- a/client/coral-admin/src/components/Comment.js +++ b/client/coral-admin/src/components/Comment.js @@ -1,11 +1,11 @@ import React from 'react'; -import {Button, Icon} from 'react-mdl'; import timeago from 'timeago.js'; import styles from './CommentList.css'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from '../translations.json'; import Linkify from 'react-linkify'; +import {FabButton} from 'coral-ui'; const linkify = new Linkify(); @@ -14,7 +14,7 @@ export default props => { const links = linkify.getMatches(props.comment.get('body')); return ( -
  • +
  • person @@ -26,12 +26,12 @@ export default props => { {links ? Contains Link : null}
    - {props.actions.map(action => canShowAction(action, props.comment) ? ( - + /> ) : null)}
    diff --git a/client/coral-admin/src/components/CommentList.js b/client/coral-admin/src/components/CommentList.js index 819de62b0..e4682252d 100644 --- a/client/coral-admin/src/components/CommentList.js +++ b/client/coral-admin/src/components/CommentList.js @@ -112,15 +112,15 @@ export default class CommentList extends React.Component { } render () { - const {singleView, commentIds, comments, hideActive} = this.props; + const {singleView, commentIds, comments, hideActive, key} = this.props; const {active} = this.state; return ( -