Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

AO3-177 Spam comments should not be included in comment counts. #2893

Merged
merged 8 commits into from Oct 5, 2017

Conversation

Projects
None yet
3 participants
Contributor

tickinginstant commented May 2, 2017

Issue

https://otwarchive.atlassian.net/browse/AO3-177

Purpose

This pull request updates the comment count code so that spam comments are no longer included in the count. It also modifies the Statistics page so that spam comment threads are no longer included in the thread count.

Testing

I posted a comment on the bug report with some detailed testing steps.

Credit

tickinginstant, she/her

tickinginstant added some commits May 2, 2017

@@ -27,7 +27,12 @@ def count_all_comments
# hidden-by-admin comments.
# returns number of visible (not deleted) comments
def count_visible_comments
- self.total_comments.count(:all, conditions: {hidden_by_admin: false, is_deleted: false, unreviewed: false})
+ self.total_comments.where(
@houndci-bot

houndci-bot May 2, 2017

Redundant self detected.

@@ -69,7 +69,7 @@ def update_stat_counter
counter = self.stat_counter || self.create_stat_counter
counter.update_attributes(
kudos_count: self.kudos.count,
- comments_count: self.total_comments.not_deleted.count,
+ comments_count: self.count_visible_comments,
@houndci-bot

houndci-bot May 2, 2017

Redundant self detected.

sarken approved these changes May 3, 2017

This looks good to me!

@@ -27,8 +27,13 @@ def count_all_comments
# hidden-by-admin comments.
# returns number of visible (not deleted) comments
def count_visible_comments
- self.total_comments.where(hidden_by_admin: false, is_deleted: false, unreviewed: false).count
- end
+ self.total_comments.where(
@houndci-bot

houndci-bot Sep 23, 2017

Redundant self detected.

@sarken sarken merged commit c0cc4bb into otwcode:master Oct 5, 2017

4 checks passed

Scrutinizer 4 new issues, 1 updated code elements
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound 2 violations found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment