Merge branch 'master' of https://github.com/coralproject/talk into post-comment

This commit is contained in:
David Jay
2016-11-07 16:29:06 -05:00
38 changed files with 681 additions and 288 deletions
+3 -11
View File
@@ -24,7 +24,7 @@ const CommentSchema = new Schema({
default: ''
},
parent_id: String
},{
}, {
timestamps: {
createdAt: 'created_at',
updatedAt: 'updated_at'
@@ -53,15 +53,7 @@ CommentSchema.statics.findByAssetId = function(asset_id) {
* @param {String} status the new status of the comment
*/
CommentSchema.statics.changeStatus = function(id, status) {
return Comment.update({'id': id}, {$set: {'status': status}}, {upsert: false}).then(() => {
Comment.findById(id).then((comment) => {
return comment;
}).catch((err) => {
console.log('Error updating status for the comment.', err);
});
}).catch((err) => {
console.log('Error updating status for the comment.', err);
});
return Comment.findOneAndUpdate({'id': id}, {$set: {'status': status}}, {upsert: false, new: true});
};
/**
@@ -71,7 +63,7 @@ CommentSchema.statics.changeStatus = function(id, status) {
*/
CommentSchema.statics.addAction = function(id, user_id, action_type) {
// check that the comment exist
var action = new Action({
let action = new Action({
action_type: action_type,
item_type: 'comment',
item_id: id,