Skip to content

Commit

Permalink
use insertOne() in rePost function, for #62
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienjoly committed Jul 20, 2017
1 parent a5e2bd9 commit d627481
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions whydJS/app/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ exports.rePost = function (pId, repostObj, handler) {
delete repostObj._id;
if (repostObj.pl && typeof repostObj.pl.id !== "number")
repostObj.pl.id = parseInt(""+repostObj.pl.id);
collection.insert(repostObj, function(error, result) {
collection.insertOne(repostObj, function(error, result) {
//console.log("result", result);
if (error) console.error("post.rePost() error: ", (error));
result = result.ops[0];
if (repostObj.uId != repostObj.repost.uId) {
notif.repost(repostObj.uId, postObj);
notif.post(postObj);
Expand All @@ -320,7 +321,7 @@ exports.rePost = function (pId, repostObj, handler) {
});
notifyMentionedUsers(result);
}
handler(result); // TODO : response.ops[0] should be returned instead => failing API test
handler(result);
});
})
}
Expand Down

0 comments on commit d627481

Please sign in to comment.