Skip to content

Commit

Permalink
Merge pull request #180 from SquareTable/165-temppollpostcomment-shou…
Browse files Browse the repository at this point in the history
…ld-return-newly-made-comment

temp/pollpostcomment now returns newly made comment
  • Loading branch information
Sebastian-Webster authored Oct 10, 2023
2 parents 6b0a1ae + 661d911 commit e412e4f
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 @@ -716,7 +716,9 @@ class TempController {
console.log(objectId)
var commentForPost = {commentId: objectId, commenterId: userId, commentsText: comment, commentUpVotes: [], commentDownVotes: [], commentReplies: [], datePosted: Date.now()}
Poll.findOneAndUpdate({_id: {$eq: postId}}, { $push: { comments: commentForPost } }).then(function(){
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 occured while updating poll to have a new comment. The comment was:', commentForPost, '. THe error was:', err)
Expand Down

0 comments on commit e412e4f

Please sign in to comment.