From 9fcd7b8d3a392a2e93e35ebdef4a50512cff3677 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Tue, 29 Nov 2016 12:16:51 -0700 Subject: [PATCH] retreiving comments based on settings was backwards --- routes/api/stream/index.js | 2 +- tests/routes/api/stream/index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index ddab5b87b..5a110e2d6 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -40,7 +40,7 @@ router.get('/', (req, res, next) => { // Fetch the appropriate comments stream. let comments; - if (settings.moderation === 'post') { + if (settings.moderation === 'pre') { comments = Comment.findAcceptedByAssetId(asset.id); } else { comments = Comment.findAcceptedAndNewByAssetId(asset.id); diff --git a/tests/routes/api/stream/index.js b/tests/routes/api/stream/index.js index 2b86f00ff..ea08ceebb 100644 --- a/tests/routes/api/stream/index.js +++ b/tests/routes/api/stream/index.js @@ -17,7 +17,7 @@ describe('/api/v1/stream', () => { const settings = { id: '1', - moderation: 'pre' + moderation: 'post' }; const comments = [{ @@ -73,7 +73,7 @@ describe('/api/v1/stream', () => { .findOrCreateByUrl('http://coralproject.net/asset2') .then((asset) => { return Asset - .overrideSettings(asset.id, {moderation: 'post'}) + .overrideSettings(asset.id, {moderation: 'pre'}) .then(() => asset); }) ]) @@ -108,7 +108,7 @@ describe('/api/v1/stream', () => { expect(res.body.comments.length).to.equal(2); expect(res.body.users.length).to.equal(2); expect(res.body.actions.length).to.equal(1); - expect(res.body.settings).to.have.property('moderation', 'pre'); + expect(res.body.settings).to.have.property('moderation', 'post'); }); }); @@ -121,7 +121,7 @@ describe('/api/v1/stream', () => { expect(res.body.assets.length).to.equal(1); expect(res.body.comments.length).to.equal(1); expect(res.body.users.length).to.equal(1); - expect(res.body.settings).to.have.property('moderation', 'post'); + expect(res.body.settings).to.have.property('moderation', 'pre'); }); }); });