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

Add indication to admin UI of whether a report has been forwarded #13237

Merged
merged 2 commits into from Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/report.rb
Expand Up @@ -14,6 +14,7 @@
# target_account_id :bigint(8) not null
# assigned_account_id :bigint(8)
# uri :string
# forwarded :boolean
#

class Report < ApplicationRecord
Expand Down
3 changes: 2 additions & 1 deletion app/services/report_service.rb
Expand Up @@ -24,7 +24,8 @@ def create_report!
target_account: @target_account,
status_ids: @status_ids,
comment: @comment,
uri: @options[:uri]
uri: @options[:uri],
forwarded: ActiveModel::Type::Boolean.new.cast(@options[:forward])
)
end

Expand Down
4 changes: 4 additions & 0 deletions app/views/admin/reports/index.html.haml
Expand Up @@ -59,6 +59,10 @@
= fa_icon('camera')
= report.media_attachments.count

- if report.forwarded?
·
= t('admin.reports.forwarded_to', domain: target_account.domain)

.report-card__summary__item__assigned
- if report.assigned_account.present?
= admin_account_link_to report.assigned_account
Expand Down
10 changes: 10 additions & 0 deletions app/views/admin/reports/show.html.haml
Expand Up @@ -46,6 +46,16 @@
%td{ colspan: 2 }
- if @report.action_taken?
= table_link_to 'envelope-open', t('admin.reports.reopen'), admin_report_path(@report, outcome: 'reopen'), method: :put
- unless @report.target_account.local?
%tr
%th= t('admin.reports.forwarded')
Copy link
Member

Choose a reason for hiding this comment

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

I think this string is missing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed 😩
Fixed.

%td{ colspan: 3 }
- if @report.forwarded.nil?
\-
- elsif @report.forwarded?
= t('simple_form.yes')
- else
= t('simple_form.no')
- if !@report.action_taken_by_account.nil?
%tr
%th= t('admin.reports.action_taken_by')
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Expand Up @@ -514,6 +514,8 @@ en:
comment:
none: None
created_at: Reported
forwarded: Forwarded
forwarded_to: Forwarded to %{domain}
mark_as_resolved: Mark as resolved
mark_as_unresolved: Mark as unresolved
notes:
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20200309150742_add_forwarded_to_reports.rb
@@ -0,0 +1,5 @@
class AddForwardedToReports < ActiveRecord::Migration[5.2]
def change
add_column :reports, :forwarded, :boolean
end
end
1 change: 1 addition & 0 deletions db/schema.rb
Expand Up @@ -717,6 +717,7 @@
t.bigint "target_account_id", null: false
t.bigint "assigned_account_id"
t.string "uri"
t.boolean "forwarded"
t.index ["account_id"], name: "index_reports_on_account_id"
t.index ["target_account_id"], name: "index_reports_on_target_account_id"
end
Expand Down