-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#159987730 Users should be able to like or dislike comment made on an article. #41
Conversation
Pull Request Test Coverage Report for Build 349
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For naming your models, you can add underscore between the words making it comment_like.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
162d1cf
to
c9028e0
Compare
@lauragift21 This has been resolved |
server/controllers/comments.js
Outdated
} | ||
|
||
/** | ||
* @description get number of likes and dislikes in an article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
misleading comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I will correct this
server/controllers/comments.js
Outdated
if (commentReaction.reaction === '1') { | ||
commentReactions.likes += 1; | ||
} else if (commentReaction.reaction === '0') { | ||
commentReactions.dislikes += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a better implementation is to find all where reaction === 0 or reaction === 1 and then total number of likes would be the length of the returned value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I will also work on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a function to check if the current logged in user already liked or disliked a comment so it can be used to format the view in the front end
…rticles - define CommentLikes Model and its association with comments and users. - write unit tests for comment like model and route. - create endpoints for authenticated users to like or dislike comments made on articles. [Delivers #159987730]
…rticles - redefine model to store integers (0, 1) for dislikes and likes - write endpoint to get all reactions of a comment [Delivers #159987730]
3a9dd91
to
b6f2003
Compare
…rticles - Refactor code on getting the number of likes and dislikes in a comment. - Define an endpoint to check if the current logged in user already liked or disliked a comment. [Delivers #159987730]
b6f2003
to
fcbb03e
Compare
What does this PR do?
Create endpoints for to like or dislike article comments
Description of Task to be completed?
Create CommentLike model and migration file
Write unit tests for feature
Create endpoint
POST api/articles/<article_slug>/comments/<commentId>/like
POST api/articles/<article_slug>/comments/<commentId>/dislike
How should this be manually tested?
Any background context you want to provide?
N/A
What are the relevant pivotal tracker stories?
159987730