Skip to content

Commit

Permalink
temp/imagepostcommentreply now returns newly made comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Webster committed Oct 10, 2023
1 parent cb7ee59 commit 5b04559
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion controllers/Temp.js
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,9 @@ class TempController {
var commentForPost = {commentId: objectId, commenterId: userId, commentsText: comment, commentUpVotes: [], commentDownVotes: [], datePosted: Date.now()}
ImagePost.findOneAndUpdate({_id: {$eq: postId}}, { $push: { [`comments.${sentIndex}.commentReplies`]: commentForPost } }).then(function(){
console.log("SUCCESS1")
return resolve(HTTPWTHandler.OK('Comment upload successful'))
commentForPost.commentId = String(commentForPost.commentId)
commentForPost.commenterId = String(commentForPost.commenterId)
return resolve(HTTPWTHandler.OK('Comment upload successful', commentForPost))
})
.catch(err => {
console.error('An error occurred while adding comment:', commentForPost, 'to:', `"comments.${sentIndex}.commentReplies`, 'of image post with id:', postId, '. The error was:', err)
Expand Down

0 comments on commit 5b04559

Please sign in to comment.