forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
262 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
%table.table | ||
%tr | ||
%th | ||
= t("report.created_at") | ||
%th | ||
= t("report.reported_by") | ||
%th | ||
= t("report.reason") | ||
%th | ||
= t("report.type") | ||
%th | ||
= t("report.originator") | ||
%th | ||
= t("report.decision") | ||
%th | ||
= t("report.action") | ||
- @reviewed_reports.each do |report| | ||
%tr | ||
%td | ||
= I18n.l(report.created_at, format: :short) | ||
%td | ||
= link_to(report.user.username, user_profile_path(report.user.username)) | ||
%td | ||
= report.text | ||
%td | ||
= report.item_type | ||
%td | ||
- unless report.originator_diaspora_handle.nil? | ||
= link_to(report.originator_diaspora_handle, "/people/#{report.originator_guid}") | ||
%td | ||
= report.action | ||
%td | ||
- unless report.item.nil? | ||
= link_to_content(report) | ||
= link_to(report_path(report.id, type: report.item_type), | ||
data: {confirm: t("report.confirm_deletion")}, | ||
title: t("report.delete_link"), | ||
class: "delete", method: :delete) do | ||
%i.entypo-trash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
- @unreviewed_reports.each do |report| | ||
- if report.item | ||
.panel.panel-default | ||
- username = report.user.username | ||
.panel-heading | ||
.reporter.pull-right | ||
!= t("report.reported_label", person: link_to(username, user_profile_path(username))) | ||
.reason | ||
%span.reason-label | ||
!= "#{t('report.created_at')}:" | ||
%span | ||
= I18n.l(report.created_at, format: :short) | ||
.reason | ||
%span.reason-label | ||
= t("report.reason_label") | ||
%span | ||
= report.text | ||
.panel-body | ||
.content | ||
= report_content(report) | ||
.segment-selection | ||
= button_to t("report.reported_user_details"), | ||
user_search_path(admins_controller_user_search: {guid: report.reported_author.guid}), | ||
class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :post | ||
= button_to t("report.review_link"), report_path(report.id, type: report.item_type), | ||
class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :put | ||
= button_to t("report.delete_link"), report_path(report.id, type: report.item_type), | ||
data: {confirm: t("report.confirm_deletion")}, | ||
class: "btn pull-right btn-danger btn-small col-md-3 col-xs-12", method: :delete | ||
- else | ||
.panel.panel-default | ||
- username = report.user.username | ||
.panel-heading | ||
.reporter.pull-right | ||
!= t("report.reported_label", person: link_to(username, user_profile_path(username))) | ||
.title | ||
= report_content(report) | ||
.panel-body | ||
= button_to t("report.review_link"), report_path(report.id, type: report.item_type), | ||
class: "btn pull-left btn-info btn-small", method: :put | ||
- if @unreviewed_reports.empty? | ||
%h3 | ||
= t("report.no_pending_reports") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,26 @@ | ||
|
||
- content_for :head do | ||
= stylesheet_link_tag :admin | ||
|
||
.reports | ||
%h1 | ||
= t("report.title") | ||
- if @reports.empty? | ||
%p | ||
= t("report.unreviewed_reports", count: 0) | ||
- @reports.each do |report| | ||
- if report.item | ||
.panel.panel-default | ||
- username = report.user.username | ||
.panel-heading | ||
.reporter.pull-right | ||
!= t("report.reported_label", person: link_to(username, user_profile_path(username))) | ||
.reason | ||
%span.reason-label | ||
= t("report.reason_label") | ||
%span | ||
= report.text | ||
.panel-body | ||
.content | ||
= report_content(report) | ||
.segment-selection | ||
= button_to t("report.reported_user_details"), | ||
user_search_path(admins_controller_user_search: {guid: report.reported_author.guid}), | ||
class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :post | ||
= button_to t("report.review_link"), report_path(report.id, type: report.item_type), | ||
class: "btn pull-left btn-info btn-small col-md-3 col-xs-12", method: :put | ||
= button_to t("report.delete_link"), report_path(report.id, type: report.item_type), | ||
data: {confirm: t("report.confirm_deletion")}, | ||
class: "btn pull-right btn-danger btn-small col-md-3 col-xs-12", method: :delete | ||
- else | ||
.panel.panel-default | ||
- username = report.user.username | ||
.panel-heading | ||
.reporter.pull-right | ||
!= t("report.reported_label", person: link_to(username, user_profile_path(username))) | ||
.title | ||
= report_content(report) | ||
.panel-body | ||
= button_to t("report.review_link"), report_path(report.id, type: report.item_type), | ||
class: "btn pull-left btn-info btn-small", method: :put | ||
%ul.nav.nav-tabs{role: "tablist"} | ||
%li.nav-item.active{role: "presentation"} | ||
%a{href: "#reports", title: t("report.tooltip_incomming"), | ||
aria: {controls: "reports", selected: true}, data: {toggle: "tab"}} | ||
= t("report.reported_tab") | ||
%li.nav-item{role: "presentation"} | ||
%a{href: "#checked", title: t("report.tooltip_reviewed"), | ||
aria: {controls: "checked", selected: false}, data: {toggle: "tab"}} | ||
= t("report.reviewed_tab") | ||
%li.nav-item{role: "presentation"} | ||
%a{href: "#statistics", title: t("report.tooltip_statistics"), | ||
aria: {controls: "statistics", selected: false}, data: {toggle: "tab"}} | ||
= t("report.statistics_tab") | ||
.tab-content | ||
.tab-pane.active#reports{role: "tabpanel"} | ||
= render partial: "report/pending" | ||
.tab-pane#checked{role: "tabpanel"} | ||
= render partial: "report/checked" | ||
.tab-pane#statistics{role: "tabpanel"} | ||
= render partial: "report/statistics" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%h3 | ||
= t("report.by_reporter") | ||
%table.table | ||
%tr | ||
%th | ||
= t("report.count") | ||
%th | ||
= t("report.reported_by") | ||
- @statistics_by_reporter.rows.each do |count, diaspora_handle, guid| | ||
%tr | ||
%td | ||
= count | ||
%td | ||
= link_to diaspora_handle, "/people/#{guid}" | ||
%h3 | ||
= t("report.by_originator") | ||
%table.table | ||
%tr | ||
%th | ||
= t("report.count") | ||
%th | ||
= t("report.originator") | ||
- @statistics_by_originator.rows.each do |count, originator_diaspora_handle, guid| | ||
%tr | ||
%td | ||
= count | ||
%td | ||
= link_to originator_diaspora_handle, "people/#{guid}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddActionToReport < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :reports, :action, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddUserFieldsToReports < ActiveRecord::Migration[5.2] | ||
def change | ||
add_column :reports, :originator_diaspora_handle, :string, index: true | ||
|
||
Report.find_each do |report| | ||
# get originator author from item before item gets deleted | ||
unless report.reported_author.nil? | ||
report.originator_diaspora_handle = report.reported_author.diaspora_handle | ||
report.save(validate: false, touch: false) | ||
end | ||
if report.item.nil? | ||
report.action = "Deleted" | ||
report.save(validate: false, touch: false) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.