Skip to content
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

#159987737 Comments should be able to track edit history #47

Merged
merged 4 commits into from
Sep 16, 2018

Conversation

CEOehis
Copy link
Contributor

@CEOehis CEOehis commented Sep 13, 2018

What does this PR do?

implement the ability to track comment edit history.

Description of Task to be completed?

Allow users update, their comments, and also track the edit history of each update.

  • add update comment method
  • prevent users from updating other users' comments
  • add relevant tests
  • use hooks to update comment history model
  • return updated comment with each update
  • add method to fetch comment edits

How should this be manually tested?

Run npm run migrate
Run npm run start:dev
send a POST request to /api/articles/ to create an article
send a POST request to /api/articles/:slug/comments to create a comment
send a PUT request to /api/articles/:slug/comments/:commentId to update the comment
send a GET request to /api/articles/:slug/comments/:commentId/edits to retrieve comment edits

What are the relevant pivotal tracker stories?

#159987737

Fetch all comments and replies for an article and include user informantion.
- update comment models: add validations.
In order to track comment history, we would need to have a copy of
the comment on each edit. Also for future queries, we've added a column
"isEdited" which is a boolean to know if the comment has been edited before and
to determine whether or not to fetch it's history.
- add isEdited column to comment table
- generate commentHistory table and migrations
- add relationship between both tables
Allow users update, their comments, and also track the edit history
of each update.
- add updateComment method
- prevent users from updating other users' comments
- add relevant tests
- use hooks to update commentHistory model
- return updated comment with each update
Users can comment and edit comments. This method fetches the comment edit history.
- Add relevant tests
- Add getCommentEdits method.
[Delivers #159987737]
@coveralls
Copy link

Pull Request Test Coverage Report for Build 402

  • 104 of 110 (94.55%) changed or added relevant lines in 8 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 92.938%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/controllers/comments.js 26 32 81.25%
Totals Coverage Status
Change from base Build 398: 0.02%
Covered Lines: 1749
Relevant Lines: 1847

💛 - Coveralls

Copy link
Contributor

@lauragift21 lauragift21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aknwosu aknwosu merged commit 244b129 into develop Sep 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants