Update method name for clarity

This commit is contained in:
David Erwin
2016-11-10 10:12:47 -05:00
parent 923edc7828
commit b6a0a99d91
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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', '']}});
};
+1 -1
View File
@@ -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.');
}
+1 -1
View File
@@ -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;}