-
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
#161966613 Comments #22
Conversation
0a91691
to
6e97f0e
Compare
""" | ||
delete comment with comment_id of article with specified slug | ||
""" | ||
try: |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
update comment with comment_id or artcle_slug | ||
""" | ||
reply_data = request.data.get('reply', {}) | ||
try: |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
""" | ||
delete comment with comment_id of article with specified slug | ||
""" | ||
try: |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
update comment with comment_id or artcle_slug | ||
""" | ||
comment_data = request.data.get('comment', {}) | ||
try: |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
**validated_data | ||
) | ||
|
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.
Similar blocks of code found in 2 locations. Consider refactoring.
- Add functionality to allow commenting articles - Add functionality to allow replying to an article comment(allow threading comments) [Delivers #161966613]
- write tests for commenting articles [Delivers #161966613]
…ality - write test for testing replying to comments of articles [Delivers #161966613]
6e97f0e
to
43ddabd
Compare
**validated_data | ||
) | ||
|
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.
Similar blocks of code found in 2 locations. Consider refactoring.
model = Reply | ||
exclude = ('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.
Similar blocks of code found in 2 locations. Consider refactoring.
'replies' | ||
) | ||
|
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.
Similar blocks of code found in 2 locations. Consider refactoring.
comments = self.queryset.filter(**filters) | ||
serializer = CommentSerializer(comments, many=True) | ||
data = serializer.data | ||
return Response({ |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
replies = self.queryset.filter(comment__id=comment_pk) | ||
serializer = ReplySerializer(replies, many=True) | ||
data = serializer.data | ||
return Response({ |
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.
Similar blocks of code found in 2 locations. Consider refactoring.
Code Climate has analyzed commit 43ddabd and detected 11 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
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
What does this pull request do?
This PR implements the CRUD methods for comments and comment replies.
Description of the tasks to be completed?
create article's comment
POST /api/articles/:slug/comments
get article's comments
GET /api/articles/:slug/comments
update article's comment
PUT /api/articles/:slug/comments/:id
delete article's comment
DELETE /api/articles/:slug/comments/:id
test the above functionalities
How should this be manually tested?
git clone https://github.com/andela/ah-technocrats.git
cd ah-technocrats
git checkout ft-comments-161966613
python3 -m venv venv
and thensource venv/bin/activate
pip install -r requirements.txt
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
testing automatically:
python manage.py test
to run automatic teststesting manually:
Screenshots:
Commenting on an article
Get comments for an article
Update an article's comment
Delete article's comment
Reply to a comment:
Get comment's replies:
Edit a comment's reply:
Delete a comment's reply:
Testsing
What are the relevant Pivotal Tracker Stories
#161966613
Checklist: