From 8af300a9ec4aaf824ac35a81541ba49c4c0f3822 Mon Sep 17 00:00:00 2001 From: David Jay Date: Mon, 28 Nov 2016 15:51:15 -0500 Subject: [PATCH 1/6] Adding users, comments, and actions to endpoint and moving to store. --- client/coral-admin/src/components/Comment.js | 15 ++++---- .../coral-admin/src/components/CommentList.js | 12 +++--- .../ModerationQueue/ModerationQueue.js | 7 +++- client/coral-admin/src/reducers/index.js | 5 ++- client/coral-admin/src/reducers/users.js | 20 ++++++++++ .../coral-admin/src/services/talk-adapter.js | 8 +++- routes/api/queue/index.js | 24 ++++++++++-- tests/routes/api/queue/index.js | 37 ++++++++++++------- 8 files changed, 92 insertions(+), 36 deletions(-) create mode 100644 client/coral-admin/src/reducers/users.js diff --git a/client/coral-admin/src/components/Comment.js b/client/coral-admin/src/components/Comment.js index 7cba85788..3481ad671 100644 --- a/client/coral-admin/src/components/Comment.js +++ b/client/coral-admin/src/components/Comment.js @@ -12,26 +12,27 @@ const linkify = new Linkify(); // Render a single comment for the list export default props => { - const links = linkify.getMatches(props.comment.get('body')); + const {comment, author} = props; + const links = linkify.getMatches(comment.get('body')); return (
  • person - {props.comment.get('name') || lang.t('comment.anon')} - {timeago().format(props.comment.get('createdAt') || (Date.now() - props.index * 60 * 1000), lang.getLocale().replace('-', '_'))} - {props.comment.get('flagged') ?

    {lang.t('comment.flagged')}

    : null} + {author.get('displayName') || lang.t('comment.anon')} + {timeago().format(comment.get('createdAt') || (Date.now() - props.index * 60 * 1000), lang.getLocale().replace('-', '_'))} + {comment.get('flagged') ?

    {lang.t('comment.flagged')}

    : null}
    {links ? Contains Link : null}
    - {props.actions.map((action, i) => canShowAction(action, props.comment) ? ( + {props.actions.map((action, i) => canShowAction(action, comment) ? ( props.onClickAction(props.actionsMap[action].status, props.comment.get('id'))} + onClick={() => props.onClickAction(props.actionsMap[action].status, comment.get('id'))} /> ) : null)}
    @@ -40,7 +41,7 @@ export default props => {
    - {props.comment.get('body')} + {comment.get('body')}
    diff --git a/client/coral-admin/src/components/CommentList.js b/client/coral-admin/src/components/CommentList.js index e4682252d..40b99b892 100644 --- a/client/coral-admin/src/components/CommentList.js +++ b/client/coral-admin/src/components/CommentList.js @@ -112,13 +112,15 @@ export default class CommentList extends React.Component { } render () { - const {singleView, commentIds, comments, hideActive, key} = this.props; + const {singleView, commentIds, comments, users, hideActive, key} = this.props; const {active} = this.state; return (
      - {commentIds.map((commentId, index) => ( - { + const comment = comments.get(commentId); + return { if (el && commentId === active) { this._active = el; } }} key={index} index={index} @@ -126,8 +128,8 @@ export default class CommentList extends React.Component { actions={this.props.actions} actionsMap={actions} isActive={commentId === active} - hideActive={hideActive} /> - )).toArray()} + hideActive={hideActive} />; + }).toArray()}
    ); } diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js index a4d82fddc..956d3df15 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js @@ -61,7 +61,7 @@ class ModerationQueue extends React.Component { // Render the tabbed lists moderation queues render () { - const {comments} = this.props; + const {comments, users} = this.props; const {activeTab, singleView, modalOpen} = this.state; return ( @@ -86,6 +86,7 @@ class ModerationQueue extends React.Component { .get('status')) } comments={comments.get('byId')} + users={users.get('byId')} onClickAction={(action, id) => this.onCommentAction(action, id)} actions={['reject', 'approve']} loading={comments.loading} /> @@ -104,6 +105,7 @@ class ModerationQueue extends React.Component { .get('status') === 'rejected') } comments={comments.get('byId')} + users={users.get('byId')} onClickAction={(action, id) => this.onCommentAction(action, id)} actions={['approve']} loading={comments.loading} /> @@ -117,6 +119,7 @@ class ModerationQueue extends React.Component { return !data.get('status') && data.get('flagged') === true; })} comments={comments.get('byId')} + users={users.get('byId')} onClickAction={(action, id) => this.onCommentAction(action, id)} actions={['reject', 'approve']} loading={comments.loading} /> @@ -129,6 +132,6 @@ class ModerationQueue extends React.Component { } } -export default connect(({comments}) => ({comments}))(ModerationQueue); +export default connect(({comments, users}) => ({comments, users}))(ModerationQueue); const lang = new I18n(translations); diff --git a/client/coral-admin/src/reducers/index.js b/client/coral-admin/src/reducers/index.js index 61029539a..1f1b444fc 100644 --- a/client/coral-admin/src/reducers/index.js +++ b/client/coral-admin/src/reducers/index.js @@ -2,6 +2,7 @@ import {combineReducers} from 'redux'; import comments from 'reducers/comments'; import settings from 'reducers/settings'; import community from 'reducers/community'; +import users from 'reducers/users'; import auth from 'reducers/auth'; // Combine all reducers into a main one @@ -9,6 +10,6 @@ export default combineReducers({ settings, comments, community, - auth + auth, + users }); - diff --git a/client/coral-admin/src/reducers/users.js b/client/coral-admin/src/reducers/users.js new file mode 100644 index 000000000..872ae904a --- /dev/null +++ b/client/coral-admin/src/reducers/users.js @@ -0,0 +1,20 @@ +import {Map, List, fromJS} from 'immutable'; + +const initialState = Map({ + byId: Map(), + ids: List() +}); + +export default (state = initialState, action) => { + switch (action.type) { + case 'USERS_MODERATION_QUEUE_FETCH_SUCCESS': return replaceUsers(action, state); + default: return state; + } +}; + +// Replace the comment list with a new one +const replaceUsers = (action, state) => { + const users = fromJS(action.users.reduce((prev, curr) => { prev[curr.id] = curr; return prev; }, {})); + return state.set('byId', users) + .set('ids', List(users.keys())); +}; diff --git a/client/coral-admin/src/services/talk-adapter.js b/client/coral-admin/src/services/talk-adapter.js index 361a6479e..dfdcec342 100644 --- a/client/coral-admin/src/services/talk-adapter.js +++ b/client/coral-admin/src/services/talk-adapter.js @@ -44,8 +44,12 @@ Promise.all([ res[2] = res[2].map(comment => { comment.flagged = true; return comment; }); return res.reduce((prev, curr) => prev.concat(curr), []); }) -.then(res => store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_SUCCESS', - comments: res})) +.then(res => { + store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_SUCCESS', + comments: res.comments}); + store.dispatch({type: 'USERS_MODERATION_QUEUE_FETCH_SUCCESS', + users: res.users}); +}) .catch(error => store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_FAILED', error})); // Update a comment. Now to update a comment we need to send back the whole object diff --git a/routes/api/queue/index.js b/routes/api/queue/index.js index f661992f1..448149387 100644 --- a/routes/api/queue/index.js +++ b/routes/api/queue/index.js @@ -1,6 +1,9 @@ const express = require('express'); const Comment = require('../../../models/comment'); +const User = require('../../../models/user'); +const Action = require('../../../models/action'); const Setting = require('../../../models/setting'); +const _ = require('lodash'); const router = express.Router(); @@ -13,11 +16,24 @@ const router = express.Router(); // Pre-moderation: New comments are shown in the moderator queues immediately. // Post-moderation: New comments do not appear in moderation queues unless they are flagged by other users. router.get('/comments/pending', (req, res, next) => { - Setting.getModerationSetting().then(function({moderation}){ - Comment.moderationQueue(moderation).then((comments) => { - res.status(200).json(comments); - }); + Setting.getModerationSetting().then(({moderation}) => + Comment.moderationQueue(moderation)) + .then((comments) => { + return Promise.all([ + comments, + User.findByIdArray(_.uniq(comments.map((comment) => comment.author_id))), + Action.getActionSummaries(_.uniq([ + ...comments.map((comment) => comment.id), + ...comments.map((comment) => comment.author_id) + ])) + ]); }) + .then(([comments, users, actions])=> + res.status(200).json({ + comments, + users, + actions + })) .catch(error => { next(error); }); diff --git a/tests/routes/api/queue/index.js b/tests/routes/api/queue/index.js index 74137a49a..1daaacbb3 100644 --- a/tests/routes/api/queue/index.js +++ b/tests/routes/api/queue/index.js @@ -20,17 +20,15 @@ beforeEach(() => { }); describe('Get moderation queues rejected, pending, flags', () => { - const comments = [{ + let comments = [{ id: 'abc', body: 'comment 10', asset_id: 'asset', - author_id: '123', status: 'rejected' }, { id: 'def', body: 'comment 20', - asset_id: 'asset', - author_id: '456' + asset_id: 'asset' }, { id: 'hij', body: 'comment 30', @@ -39,41 +37,52 @@ describe('Get moderation queues rejected, pending, flags', () => { }]; const users = [{ + id: '456', displayName: 'Ana', email: 'ana@gmail.com', password: '123' }, { + id: '123', displayName: 'Maria', email: 'maria@gmail.com', password: '123' }]; - const actions = [{ + let actions = [{ action_type: 'flag', - item_id: 'abc', item_type: 'comment' }, { action_type: 'like', - item_id: 'hij', item_type: 'comment' }]; beforeEach(() => { - return Promise.all([ - Comment.create(comments), - User.createLocalUsers(users), - Action.create(actions) - ]); + return User.createLocalUsers(users) + .then((u) => { + comments[0].author_id = u[0].id; + comments[1].author_id = u[1].id; + comments[2].author_id = u[1].id; + + return Comment.create(comments); + }) + .then((c) => { + actions[0].item_id = c[0].id; + actions[1].item_id = c[1].id; + + return Action.create(actions); + }); }); - it('should return all the pending comments', function(done){ + it('should return all the pending comments, users and actions', function(done){ chai.request(app) .get('/api/v1/queue/comments/pending') .set(passport.inject({roles: ['admin']})) .end(function(err, res){ expect(err).to.be.null; expect(res).to.have.status(200); - expect(res.body[0]).to.have.property('id', 'def'); + expect(res.body.comments[0]).to.have.property('body'); + expect(res.body.users[0]).to.have.property('displayName'); + expect(res.body.actions[0]).to.have.property('action_type'); done(); }); }); From 5f2f70fd517d9dd983274e5485532533aa129c4e Mon Sep 17 00:00:00 2001 From: David Jay Date: Mon, 28 Nov 2016 18:59:27 -0500 Subject: [PATCH 2/6] Fixing bug when adding users to redux. --- client/coral-admin/src/services/talk-adapter.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/coral-admin/src/services/talk-adapter.js b/client/coral-admin/src/services/talk-adapter.js index 31978453a..a2bd5140c 100644 --- a/client/coral-admin/src/services/talk-adapter.js +++ b/client/coral-admin/src/services/talk-adapter.js @@ -40,13 +40,15 @@ Promise.all([ .then(res => Promise.all(res.map(handleResp))) .then(res => { res[2] = res[2].map(comment => { comment.flagged = true; return comment; }); - return res.reduce((prev, curr) => prev.concat(curr), []); + res[0].comments = res[0].comments.concat(res[1]).concat(res[2]); + return res[0]; }) .then(res => { - store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_SUCCESS', - comments: res.comments}); + console.log(res); store.dispatch({type: 'USERS_MODERATION_QUEUE_FETCH_SUCCESS', users: res.users}); + store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_SUCCESS', + comments: res.comments}); }) .catch(error => store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_FAILED', error})); From b7ffd31ea47acbee417cf9b256b0b5ed2d947dee Mon Sep 17 00:00:00 2001 From: David Jay Date: Tue, 29 Nov 2016 16:37:39 -0500 Subject: [PATCH 3/6] Cleaning up tests after merge. --- models/setting.js | 1 + routes/api/stream/index.js | 2 +- tests/routes/api/stream/index.js | 152 +++++++++++++++---------------- 3 files changed, 78 insertions(+), 77 deletions(-) diff --git a/models/setting.js b/models/setting.js index f0c6a1abc..e23f654a7 100644 --- a/models/setting.js +++ b/models/setting.js @@ -42,6 +42,7 @@ SettingSchema.statics.getSettings = function () { * @return {Promise} moderation the settings for how to moderate comments */ SettingSchema.statics.getModerationSetting = function () { + console.log('Getting moderation setting'); return this.findOne({id: '1'}).select('moderation'); }; diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index 5a110e2d6..ce8871ab8 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -34,7 +34,7 @@ router.get('/', (req, res, next) => { // Merge the asset specific settings with the returned settings object in // the event that the asset that was returned also had settings. if (asset.settings) { - settings = Object.assign(settings, asset.settings); + settings = Object.assign({}, settings, asset.settings); } // Fetch the appropriate comments stream. diff --git a/tests/routes/api/stream/index.js b/tests/routes/api/stream/index.js index ea08ceebb..6484fdc12 100644 --- a/tests/routes/api/stream/index.js +++ b/tests/routes/api/stream/index.js @@ -14,90 +14,90 @@ const Asset = require('../../../../models/asset'); const Setting = require('../../../../models/setting'); describe('/api/v1/stream', () => { + describe('#get', () => { + const settings = { + id: '1', + moderation: 'post' + }; - const settings = { - id: '1', - moderation: 'post' - }; + let comments; - const comments = [{ - id: 'abc', - body: 'comment 10', - author_id: '', - parent_id: '', - status: 'accepted' - }, { - id: 'def', - body: 'comment 20', - author_id: '', - parent_id: '', - status: '' - }, { - id: 'uio', - body: 'comment 30', - asset_id: 'asset', - author_id: '456', - parent_id: '', - status: 'accepted' - }, { - id: 'hij', - body: 'comment 40', - asset_id: '456', - status: 'rejected' - }]; + const users = [{ + displayName: 'Ana', + email: 'ana@gmail.com', + password: '123' + }, { + displayName: 'Maria', + email: 'maria@gmail.com', + password: '123' + }]; - const users = [{ - displayName: 'Ana', - email: 'ana@gmail.com', - password: '123' - }, { - displayName: 'Maria', - email: 'maria@gmail.com', - password: '123' - }]; + const actions = [{ + action_type: 'flag', + item_id: 'abc' + }, { + action_type: 'like', + item_id: 'hij' + }]; - const actions = [{ - action_type: 'flag', - item_id: 'abc' - }, { - action_type: 'like', - item_id: 'hij' - }]; + beforeEach(() => { - beforeEach(() => { - - return Promise.all([ - User.createLocalUsers(users), - Asset.findOrCreateByUrl('http://test.com'), - Asset - .findOrCreateByUrl('http://coralproject.net/asset2') - .then((asset) => { - return Asset - .overrideSettings(asset.id, {moderation: 'pre'}) - .then(() => asset); - }) - ]) - .then(([users, asset1, asset2]) => { - - comments[0].author_id = users[0].id; - comments[1].author_id = users[1].id; - comments[2].author_id = users[0].id; - comments[3].author_id = users[1].id; - - comments[0].asset_id = asset1.id; - comments[1].asset_id = asset1.id; - comments[2].asset_id = asset2.id; - comments[3].asset_id = asset2.id; + comments = [{ + id: 'abc', + body: 'comment 10', + author_id: '', + parent_id: '', + status: 'accepted' + }, { + id: 'def', + body: 'comment 20', + author_id: '', + parent_id: '', + status: '' + }, { + id: 'uio', + body: 'comment 30', + asset_id: 'asset', + author_id: '456', + parent_id: '', + status: 'accepted' + }, { + id: 'hij', + body: 'comment 40', + asset_id: '456', + status: 'rejected' + }]; return Promise.all([ - Comment.create(comments), - Action.create(actions), - Setting.create(settings) - ]); - }); - }); + User.createLocalUsers(users), + Asset.findOrCreateByUrl('http://test.com'), + Asset + .findOrCreateByUrl('http://coralproject.net/asset2') + .then((asset) => { + return Asset + .overrideSettings(asset.id, {moderation: 'pre'}) + .then(() => asset); + }) + ]) + .then(([users, asset1, asset2]) => { - describe('#get', () => { + comments[0].author_id = users[0].id; + comments[1].author_id = users[1].id; + comments[2].author_id = users[0].id; + comments[3].author_id = users[1].id; + + comments[0].asset_id = asset1.id; + comments[1].asset_id = asset1.id; + comments[2].asset_id = asset2.id; + comments[3].asset_id = asset2.id; + + return Promise.all([ + Comment.create(comments), + Action.create(actions), + Setting.init().then(() => Setting.updateSettings(settings)) + ]); + }); + }); it('should return a stream with comments, users and actions for an existing asset', () => { return chai.request(app) .get('/api/v1/stream') From 17b79e1869ec6dc10e0b5c6330d4062c9d64c3c6 Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 30 Nov 2016 13:51:43 -0500 Subject: [PATCH 4/6] Adding user and action data to rejected and flagged comments. --- .../containers/CommentStream/CommentStream.js | 5 +-- .../ModerationQueue/ModerationQueue.js | 4 +-- .../coral-admin/src/services/talk-adapter.js | 32 +++++++++++++------ routes/api/comments/index.js | 20 ++++++++++-- tests/routes/api/comments/index.js | 13 ++++---- 5 files changed, 53 insertions(+), 21 deletions(-) diff --git a/client/coral-admin/src/containers/CommentStream/CommentStream.js b/client/coral-admin/src/containers/CommentStream/CommentStream.js index b1e002549..113a7bc86 100644 --- a/client/coral-admin/src/containers/CommentStream/CommentStream.js +++ b/client/coral-admin/src/containers/CommentStream/CommentStream.js @@ -40,7 +40,7 @@ class CommentStream extends React.Component { } // Render the comment box along with the CommentList - render ({comments}, {snackbar, snackbarMsg}) { + render ({comments, users}, {snackbar, snackbarMsg}) { return (
    @@ -48,6 +48,7 @@ class CommentStream extends React.Component { singleView={false} commentIds={comments.get('ids')} comments={comments.get('byId')} + users={users.get('byId')} onClickAction={this.onClickAction} actions={['flag']} loading={comments.loading} /> @@ -57,4 +58,4 @@ class CommentStream extends React.Component { } } -export default connect(({comments}) => ({comments}))(CommentStream); +export default connect(({comments, users}) => ({comments, users}))(CommentStream); diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js index 956d3df15..654f0e90c 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js @@ -82,8 +82,8 @@ class ModerationQueue extends React.Component { commentIds={ comments.get('ids') .filter(id => !comments.get('byId') - .get(id) - .get('status')) + .get(id) + .get('flagged')) } comments={comments.get('byId')} users={users.get('byId')} diff --git a/client/coral-admin/src/services/talk-adapter.js b/client/coral-admin/src/services/talk-adapter.js index 945d73e26..6d79406a6 100644 --- a/client/coral-admin/src/services/talk-adapter.js +++ b/client/coral-admin/src/services/talk-adapter.js @@ -34,19 +34,33 @@ Promise.all([ coralApi('/comments?status=rejected'), coralApi('/comments?action_type=flag') ]) -.then(res => Promise.all(res.map(coralApi.handleResp))) .then(([pending, rejected, flagged]) => { - flagged = flagged.map(comment => comment.flagged = true); - pending.comments = pending.comments.concat(rejected).concat(flagged); - return pending; + /* Combine seperate calls into a single object */ + let all = {}; + all.comments = pending.comments + .concat(rejected.comments) + .concat(flagged.comments.map(comment => { + comment.flagged = true; + return comment; + })); + all.users = pending.users + .concat(rejected.users) + .concat(flagged.users); + all.actions = pending.actions + .concat(rejected.actions) + .concat(flagged.actions); + return all; }) -.then(res => { +.then(all => { + console.log('All', all); + /* Post comments and users to redux store. Actions will be posted when they are needed. */ store.dispatch({type: 'USERS_MODERATION_QUEUE_FETCH_SUCCESS', - users: res.users}); + users: all.users}); store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_SUCCESS', - comments: res.comments}); -}) -.catch(error => store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_FAILED', error})); + comments: all.comments}); + +}); +// .catch(error => store.dispatch({type: 'COMMENTS_MODERATION_QUEUE_FETCH_FAILED', error})); // Update a comment. Now to update a comment we need to send back the whole object diff --git a/routes/api/comments/index.js b/routes/api/comments/index.js index bfb3d67ab..3bdf4afc6 100644 --- a/routes/api/comments/index.js +++ b/routes/api/comments/index.js @@ -1,7 +1,10 @@ const express = require('express'); const Comment = require('../../../models/comment'); +const User = require('../../../models/user'); +const Action = require('../../../models/action'); const wordlist = require('../../../services/wordlist'); const authorization = require('../../../middleware/authorization'); +const _ = require('lodash'); const router = express.Router(); @@ -16,9 +19,22 @@ router.get('/', authorization.needed('admin'), (req, res, next) => { query = Comment.all(); } - query.then(comments => { - res.json(comments); + query.then((comments) => { + return Promise.all([ + comments, + User.findByIdArray(_.uniq(comments.map((comment) => comment.author_id))), + Action.getActionSummaries(_.uniq([ + ...comments.map((comment) => comment.id), + ...comments.map((comment) => comment.author_id) + ])) + ]); }) + .then(([comments, users, actions])=> + res.status(200).json({ + comments, + users, + actions + })) .catch((err) => { next(err); }); diff --git a/tests/routes/api/comments/index.js b/tests/routes/api/comments/index.js index 5ac9af7b7..bc8b67bc1 100644 --- a/tests/routes/api/comments/index.js +++ b/tests/routes/api/comments/index.js @@ -37,6 +37,7 @@ describe('/api/v1/comments', () => { id: 'hij', body: 'comment 30', asset_id: '456', + author_id: '456', status: 'accepted' }]; @@ -90,7 +91,7 @@ describe('/api/v1/comments', () => { .set(passport.inject({roles: ['admin']})) .then((res) => { expect(res).to.have.status(200); - expect(res.body[0]).to.have.property('id', 'def-rejected'); + expect(res.body.comments[0]).to.have.property('id', 'def-rejected'); }); }); @@ -100,8 +101,8 @@ describe('/api/v1/comments', () => { .set(passport.inject({roles: ['admin']})) .then((res) => { expect(res).to.have.status(200); - expect(res.body).to.have.length(1); - expect(res.body[0]).to.have.property('id', 'hij'); + expect(res.body.comments).to.have.length(1); + expect(res.body.comments[0]).to.have.property('id', 'hij'); }); }); @@ -111,7 +112,7 @@ describe('/api/v1/comments', () => { .set(passport.inject({roles: ['admin']})) .then((res) => { expect(res).to.have.status(200); - expect(res.body).to.have.length(2); + expect(res.body.comments).to.have.length(2); }); }); @@ -122,8 +123,8 @@ describe('/api/v1/comments', () => { .then((res) => { expect(res).to.have.status(200); - expect(res.body).to.have.length(1); - expect(res.body[0]).to.have.property('id', 'abc'); + expect(res.body.comments).to.have.length(1); + expect(res.body.comments[0]).to.have.property('id', 'abc'); }); }); From 03db1de41ab8e23689cf39e40c262d4008264599 Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 30 Nov 2016 15:15:58 -0500 Subject: [PATCH 5/6] Removing log statement. --- client/coral-admin/src/services/talk-adapter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/coral-admin/src/services/talk-adapter.js b/client/coral-admin/src/services/talk-adapter.js index 6d79406a6..5502df7ed 100644 --- a/client/coral-admin/src/services/talk-adapter.js +++ b/client/coral-admin/src/services/talk-adapter.js @@ -52,7 +52,6 @@ Promise.all([ return all; }) .then(all => { - console.log('All', all); /* Post comments and users to redux store. Actions will be posted when they are needed. */ store.dispatch({type: 'USERS_MODERATION_QUEUE_FETCH_SUCCESS', users: all.users}); From 34671fb32737fb1b9ef5c783d33ceaea2d6f392d Mon Sep 17 00:00:00 2001 From: David Jay Date: Wed, 30 Nov 2016 15:38:43 -0500 Subject: [PATCH 6/6] Fixing filter in moderation queue. --- .../src/containers/ModerationQueue/ModerationQueue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js index 654f0e90c..e5670d169 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js @@ -83,7 +83,7 @@ class ModerationQueue extends React.Component { comments.get('ids') .filter(id => !comments.get('byId') .get(id) - .get('flagged')) + .get('status')) } comments={comments.get('byId')} users={users.get('byId')}