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;}