AO3-7275 Unreviewed comments marked as spam are still visible to creators#5577
AO3-7275 Unreviewed comments marked as spam are still visible to creators#5577archie-2006 wants to merge 1 commit intootwcode:masterfrom
Conversation
Updated comment to include not_spam scope filter unreviewed comments in commentscontroller using not_spam update specs to verify spam comments are excluded from viewing
|
Hi, Archie Singh! Thank you so much for this pull request, someone will be along to review it soon. I've also updated the Jira issue status to In Review so no one will mistakenly create a duplicate pull request. If you'd like the ability to comment on, assign, and transition issues in the future, you're welcome to create a Jira account! It makes things a bit easier for us on the organizational side if the Full Name on your Jira account either closely matches the name you'd like us to credit in the release notes or includes it in parentheses, e.g. "Nickname (CREDIT NAME)." Once you've done that (or if you've already done it -- Jira has been unreliable about showing us new accounts in the admin panel lately), you can either reply here or send an email to otw-coders@transformativeworks.org with your account name and email address and we'll set up the permissions for you. Thanks again for contributing! If you have any questions, you can contact us at the same email address listed above. |
Bilka2
left a comment
There was a problem hiding this comment.
Thanks for getting started on this! Please also adjust app/views/works/_work_header_navigation.html.erb to display the correct comment count for users
| scope :top_level, -> { where.not(commentable_type: "Comment") } | ||
| scope :include_pseud, -> { includes(:pseud) } | ||
| scope :not_deleted, -> { where(is_deleted: false) } | ||
| scope :not_spam, -> { where(spam: false) } |
There was a problem hiding this comment.
This scope should read the approved column instead (and then it has to be true), per AO3-5997 we are not yet reading from the spam column
| end | ||
| end | ||
|
|
||
| describe ".not_spam" do |
There was a problem hiding this comment.
since this scope is rather simple, we don't really need a unit test for it. Instead, it would be good to have an integration test (so a cucumber test) for the comments showing up/not showing up for admins/users
|
|
||
| it "excludes comments marked as spam" do | ||
| spam_comment = create(:comment, spam: true) | ||
| expect(Comment.not_spam).not_to include(spam_comment) |
There was a problem hiding this comment.
but if you were wondering why this fails: the spam status is set on creation of the comment (to the default false), so the spam: true that is specified above is getting overridden.
Updated comment to include not_spam scope
filter unreviewed comments in commentscontroller using not_spam update specs to verify spam comments are excluded from viewing
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-7275
Purpose
Unreviewed comments marked as spam remained visible to creators in the unreviewed comments.
added a not_spam scope to filter out spam-flagged comments.
applied the not_spam scope to the index action for unreviewed comments.
while creators have their view filtered, admins retain full visibility of all unreviewed comments for moderation.
modified comment_spec.rb to verify the exclusion of spam from these filtered collections.
References
fixes the issue where unreviewed spam comments behaved differently than reviewed spam comments for creators.
updates the unreviewed comments counter consistently
Credit
Archie Singh (she/her/hers)