Skip to content

Commit

Permalink
Fixed Review issues
Browse files Browse the repository at this point in the history
- added migration for new report action column
- added author field on pending reports UI
- added tests for reviewed and deleted reports
  • Loading branch information
tclaus committed Aug 28, 2021
1 parent c9dc522 commit 0adc2aa
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/report/_pending.haml
Expand Up @@ -5,12 +5,12 @@
.panel-heading
.reporter.pull-right
!= t("report.reported_label", person: link_to(username, user_profile_path(username)))
.reason
.author
%span.reason-label
!= "#{t('report.author')}:"
%span
= report.author.name
.reason
.created-at
%span.reason-label
!= "#{t('report.created_at')}:"
%span
Expand Down
41 changes: 41 additions & 0 deletions features/desktop/report.feature
Expand Up @@ -44,3 +44,44 @@ Feature: reporting of posts and comments
When I go to the report page
Then I should see a report by "alice@alice.alice" with reason "That's my reason" on comment "Bob comment"
And "alice@alice.alice" should have received an email with subject "A new comment was marked as offensive"

Scenario: A checked report appears in the Reviewed section as reviewed
Given I sign in as "alice@alice.alice"
And I am on the public stream page
When I hover over the ".stream-element"
And I click to report the post
Then I should see the report modal
When I fill in "report-reason-field" with "That's my reason"
And I submit the form
When I go to the report page
And I mark report as reviewed
When I open the reviewed tab on the report page
Then I should see the reviewed report with decision No Action

Scenario: A deleted report content appears in the Reviewed section as deleted
Given I sign in as "alice@alice.alice"
And I am on the public stream page
When I hover over the ".stream-element"
And I click to report the post
Then I should see the report modal
When I fill in "report-reason-field" with "That should no be here"
And I submit the form
When I go to the report page
And I mark report as deleted
When I open the reviewed tab on the report page
Then I should see the reviewed report with decision Deleted

Scenario: A reviewed report can be deleted afterwards
Given I sign in as "alice@alice.alice"
And I am on the public stream page
When I hover over the ".stream-element"
And I click to report the post
Then I should see the report modal
When I fill in "report-reason-field" with "That's my reason"
And I submit the form
When I go to the report page
And I mark report as reviewed
When I open the reviewed tab on the report page
And I confirm the alert after I delete the reviewed report
When I open the reviewed tab on the report page
Then I should see the reviewed report with decision Deleted
29 changes: 29 additions & 0 deletions features/step_definitions/report_steps.rb
Expand Up @@ -21,3 +21,32 @@ def test_report(type, reporter, reason, content)
step %(I should see "#{reason}" within ".reason")
step %(I should see "#{type}: #{content}" within ".content")
end

And(/^I mark report as reviewed$/) do
click_button("Mark as reviewed")
end

And(/^I mark report as deleted$/) do
click_button("Delete item")
end

And(/^I delete the reviewed report$/) do
find_link(title: "Delete item").click
end

When(/^I open the reviewed tab on the report page$/) do
find_link("Reviewed").click
end

Then(/^I should see the reviewed report with decision No Action$/) do
within("#checked") do
find("tr", text: "No Action")
end
end

Then(/^I should see the reviewed report with decision Deleted$/) do
within("#checked") do
find("tr", text: "Deleted")
end
end

0 comments on commit 0adc2aa

Please sign in to comment.