|
|
@ -253,6 +253,23 @@ class CommentService extends SiteService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fullComment.contentHistory || [ ];
|
|
|
|
return fullComment.contentHistory || [ ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Deletes all comments filed against a given resource.
|
|
|
|
|
|
|
|
* @param {Resource} resource The resource for which all comments are to be
|
|
|
|
|
|
|
|
* deleted (physically removed from database).
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
async deleteForResource (resource) {
|
|
|
|
|
|
|
|
const { contentReport: contentReportService } = this.dtp.services;
|
|
|
|
|
|
|
|
this.log.info('deleting all comments for resource', { resourceId: resource._id });
|
|
|
|
|
|
|
|
await Comment
|
|
|
|
|
|
|
|
.find({ resource: resource._id })
|
|
|
|
|
|
|
|
.cursor()
|
|
|
|
|
|
|
|
.eachAsync(async (comment) => {
|
|
|
|
|
|
|
|
await contentReportService.removeForResource(comment);
|
|
|
|
|
|
|
|
await Comment.deleteOne({ _id: comment._id });
|
|
|
|
|
|
|
|
}, 4);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
module.exports = {
|
|
|
|