-
Notifications
You must be signed in to change notification settings - Fork 39
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
fix: 🍰 Comment Counters Are Now Equal #3769
Conversation
… we see that the test checks the comment count to ignore disabled and deleted comments.
…ctly after the event is triggered.
…ostComments so that issue are fixed.
…ply to comment edited. Test update comment added. Test delete comment pending.
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Hey @Elweyn , can you run the linter on PS: In case you work on the locale files in the |
content: 'this is a deleted comment', | ||
deleted: true, | ||
author: { id: 'some-user' }, | ||
}, |
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.
Authored by Tirokk
Aug 4, 2020
Outdated (history rewrite) - original diff
@@ -28,6 +28,13 @@ describe('CommentList.vue', () => {
content: 'this is a comment',
author: { id: 'some-user' },
},
+ {
+ id: 'comment135',
+ contentExcerpt: 'this is a deleted comment',
+ content: 'this is a deleted comment',
+ deleted: true,
+ author: { id: 'some-user' },
+ },
Because of a different solution I suggest in the next comment👇🏼 this test makes no sense anymore.
Would be cool to replace it with a test in backend/src/schema/resolvers/posts.spec.js
which checks that only comments not deleted and not disabled are counted by the Cypher queries.
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.
Authored by Elweyn
Aug 5, 2020
Thanks for the response. I think it is important to check if their are deleted comments that it does not break the other tests, so we could let this one and add another one in backend/src/schema/resolvers/posts.spec.js to check if the count is setten correctly what do you think?
@@ -1,12 +1,12 @@ | |||
<template> | |||
<div id="comments" class="comment-list"> | |||
<h3 class="title"> | |||
<counter-icon icon="comments" :count="postComments.length" /> | |||
<counter-icon icon="comments" :count="commentsCount" /> | |||
{{ $t('common.comment', null, 0) }} | |||
</h3> |
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.
Authored by Tirokk
Aug 4, 2020
Outdated (history rewrite) - original diff
@@ -1,7 +1,10 @@
<template>
<div id="comments" class="comment-list">
<h3 class="title">
- <counter-icon icon="comments" :count="postComments.length" />
+ <counter-icon
+ icon="comments"
+ :count="postComments.filter((comment) => !comment.deleted).length"
I looked at the other place in webapp/components/PostTeaser/PostTeaser.vue
where the counter is set on a post teaser. This is the part which differs from that here.
Because I know this value of post.commentsCount
comes direct from the backend and because I have found this doesn’t count comment.deleted
or comment.disabled
I will suggest this solution to be taken over here.
</h3> | |
:count="post.commentsCount“ |
A test in backend/src/schema/resolvers/posts.spec.js
is missing which checks that only comments not deleted and not disabled are counted by the Cypher queries.
If you are motivated would be nice to implement this one. 💫🍀
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.
Authored by Elweyn
Aug 5, 2020
Thanks a lot, this one seems a lot better than a filter on the deleted comments!
I will implement this so the frontend code stays clean of logic.
Hi @Tirokk Since the value of post.commentsCount is not updated as long as we don't make a reload of the page, we decided to make a computed property commentsCount that make use the first written filter. Hope this seems good. |
}, | ||
}, | ||
{ | ||
id: 'comment135', |
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.
Authored by Tirokk
Aug 7, 2020
Outdated (history rewrite) - original diff
@@ -28,6 +28,20 @@ describe('CommentList.vue', () => {
content: 'this is a comment',
author: { id: 'some-user' },
},
+ {
+ id: 'comment135',
+ contentExcerpt: 'this is a deleted comment',
+ content: 'this is a deleted comment',
+ deleted: true,
+ author: { id: 'some-user' },
+ },
+ {
+ id: 'comment136',
+ contentExcerpt: 'this is a disabled comment',
+ content: 'this is a disabled comment',
+ disabled: true,
+ author: { id: 'some-user' },
+ },
Okay. Cool!
Then this test extension is needed. 😍
@@ -36,8 +36,13 @@ export default { | |||
}, | |||
}, | |||
computed: { |
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.
Authored by Tirokk
Aug 7, 2020
Outdated (history rewrite) - original diff
@@ -39,6 +39,14 @@ export default {
postComments() {
return (this.post && this.post.comments) || []
},
This code is now superfluous, I think.
Testing that a comment is updated after editing would be great. |
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.
Hey @Elweyn ,
supercool you have cared for this one. 🚀
Glad to have you in our project!
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.
Great work. Thanx
fix: 🍰 Comment Counters Are Now Equal
[WIP] 🍰 Pullrequest 2112
Changed the filter so that the comments that are deleted are not counted in the comment number anymore
Issues
Todo