From b6a0a99d913697e40fd28e61f9c7b2d1182fc10d Mon Sep 17 00:00:00 2001 From: David Erwin Date: Thu, 10 Nov 2016 10:10:55 -0500 Subject: [PATCH] Update method name for clarity --- models/comment.js | 2 +- routes/api/stream/index.js | 2 +- tests/models/comment.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/comment.js b/models/comment.js index 03f3363be..3f99bcb6a 100644 --- a/models/comment.js +++ b/models/comment.js @@ -77,7 +77,7 @@ CommentSchema.statics.findAcceptedByAssetId = function(asset_id) { * Finds the new and accepted comments by the asset_id. * @param {String} asset_id identifier of the asset which owns the comments (uuid) */ -CommentSchema.statics.findNewByAssetId = function(asset_id) { +CommentSchema.statics.findAcceptedAndNewByAssetId = function(asset_id) { return Comment.find({asset_id: asset_id, status: {'$in': ['accepted', '']}}); }; diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index 9fe7ac62a..4fe266294 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -17,7 +17,7 @@ router.get('/', (req, res, next) => { case 'pre': return Comment.findAcceptedByAssetId(req.query.asset_id); case 'post': - return Comment.findNewByAssetId(req.query.asset_id); + return Comment.findAcceptedAndNewByAssetId(req.query.asset_id); default: throw new Error('Moderation setting not found.'); } diff --git a/tests/models/comment.js b/tests/models/comment.js index f81cb7609..2a8225c72 100644 --- a/tests/models/comment.js +++ b/tests/models/comment.js @@ -103,7 +103,7 @@ describe('Comment: models', () => { }); }); it('should find an array of new and accepted comments by asset id', () => { - return Comment.findNewByAssetId('123').then((result) => { + return Comment.findAcceptedAndNewByAssetId('123').then((result) => { expect(result).to.have.length(2); result.sort((a, b) => { if (a.body < b.body) {return -1;}