mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
Update method name for clarity
This commit is contained in:
+1
-1
@@ -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', '']}});
|
||||
};
|
||||
|
||||
|
||||
@@ -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.');
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
|
||||
Reference in New Issue
Block a user