From 5b0455905445dabf94913d940bbbce4551163e50 Mon Sep 17 00:00:00 2001 From: Sebastian-Webster Date: Tue, 10 Oct 2023 18:22:08 +1300 Subject: [PATCH] temp/imagepostcommentreply now returns newly made comment --- controllers/Temp.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/Temp.js b/controllers/Temp.js index c99e4e71..e5412158 100644 --- a/controllers/Temp.js +++ b/controllers/Temp.js @@ -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)