Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Commit

Permalink
Group reports by target account (mastodon#8674)
Browse files Browse the repository at this point in the history
* Group reports by target account

* Improve CSS
  • Loading branch information
Gargron authored and kyori19 committed Sep 17, 2018
1 parent 57c23d3 commit b4c7a2e
Show file tree
Hide file tree
Showing 48 changed files with 154 additions and 227 deletions.
4 changes: 2 additions & 2 deletions app/helpers/admin/account_moderation_notes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Admin::AccountModerationNotesHelper
def admin_account_link_to(account)
return if account.nil?

link_to admin_account_path(account.id), class: name_tag_classes(account) do
link_to admin_account_path(account.id), class: name_tag_classes(account), title: account.acct do
safe_join([
image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'),
content_tag(:span, account.acct, class: 'username'),
Expand All @@ -15,7 +15,7 @@ def admin_account_link_to(account)
def admin_account_inline_link_to(account)
return if account.nil?

link_to admin_account_path(account.id), class: name_tag_classes(account, true) do
link_to admin_account_path(account.id), class: name_tag_classes(account, true), title: account.acct do
content_tag(:span, account.acct, class: 'username')
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/helpers/home_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ def default_props
}
end

def account_link_to(account, button = '')
def account_link_to(account, button = '', size: 36, path: nil)
content_tag(:div, class: 'account') do
content_tag(:div, class: 'account__wrapper') do
section = if account.nil?
content_tag(:div, class: 'account__display-name') do
content_tag(:div, class: 'account__avatar-wrapper') do
content_tag(:div, '', class: 'account__avatar', style: "background-image: url(#{full_asset_url('avatars/original/missing.png', skip_pipeline: true)})")
content_tag(:div, '', class: 'account__avatar', style: "width: #{size}px; height: #{size}px; background-size: #{size}px #{size}px; background-image: url(#{full_asset_url('avatars/original/missing.png', skip_pipeline: true)})")
end +
content_tag(:span, class: 'display-name') do
content_tag(:strong, t('about.contact_missing')) +
content_tag(:span, t('about.contact_unavailable'), class: 'display-name__account')
end
end
else
link_to(TagManager.instance.url_for(account), class: 'account__display-name') do
link_to(path || TagManager.instance.url_for(account), class: 'account__display-name') do
content_tag(:div, class: 'account__avatar-wrapper') do
content_tag(:div, '', class: 'account__avatar', style: "background-image: url(#{account.avatar.url})")
content_tag(:div, '', class: 'account__avatar', style: "width: #{size}px; height: #{size}px; background-size: #{size}px #{size}px; background-image: url(#{account.avatar.url})")
end +
content_tag(:span, class: 'display-name') do
content_tag(:bdi) do
Expand Down
99 changes: 99 additions & 0 deletions app/javascript/styles/mastodon/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -567,3 +567,102 @@ a.name-tag,
color: $dark-text-color;
}
}

.report-card {
background: $ui-base-color;
border-radius: 4px;
margin-bottom: 20px;

&__profile {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px;

.account {
padding: 0;
border: 0;

&__avatar-wrapper {
margin-left: 0;
}
}

&__stats {
flex: 0 0 auto;
font-weight: 500;
color: $darker-text-color;
text-transform: uppercase;
text-align: right;

a {
color: inherit;
text-decoration: none;

&:focus,
&:hover,
&:active {
color: lighten($darker-text-color, 8%);
}
}

.red {
color: $error-value-color;
}
}
}

&__summary {
&__item {
display: flex;
justify-content: flex-start;
border-top: 1px solid darken($ui-base-color, 4%);

&:hover {
background: lighten($ui-base-color, 2%);
}

&__reported-by,
&__assigned {
padding: 15px;
flex: 0 0 auto;
box-sizing: border-box;
width: 150px;
color: $darker-text-color;

&,
.username {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}

&__content {
flex: 1 1 auto;
max-width: calc(100% - 300px);

&__icon {
color: $dark-text-color;
margin-right: 4px;
font-weight: 500;
}
}

&__content a {
display: block;
box-sizing: border-box;
width: 100%;
padding: 15px;
text-decoration: none;
color: $darker-text-color;
}
}
}
}

.one-line {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
19 changes: 0 additions & 19 deletions app/views/admin/reports/_account.html.haml

This file was deleted.

29 changes: 0 additions & 29 deletions app/views/admin/reports/_report.html.haml

This file was deleted.

52 changes: 40 additions & 12 deletions app/views/admin/reports/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,45 @@
%li= filter_link_to t('admin.reports.unresolved'), resolved: nil
%li= filter_link_to t('admin.reports.resolved'), resolved: '1'

.table-wrapper
%table.table
%thead
%tr
%th= t('admin.reports.id')
%th= t('admin.reports.target')
%th= t('admin.reports.reported_by')
%th= t('admin.reports.report_contents')
%th= t('admin.reports.assigned')
%th
%tbody
= render @reports
- @reports.group_by(&:target_account_id).each do |target_account_id, reports|
- target_account = reports.first.target_account
.report-card
.report-card__profile
= account_link_to target_account, '', size: 36, path: admin_account_path(target_account.id)
.report-card__profile__stats
= link_to pluralize(target_account.targeted_moderation_notes.count, t('admin.reports.account.note')), admin_account_path(target_account.id)
%br/
- if target_account.suspended?
%span.red= t('admin.accounts.suspended')
- elsif target_account.silenced?
%span.red= t('admin.accounts.silenced')
- elsif target_account.user&.disabled?
%span.red= t('admin.accounts.disabled')
- else
%span.neutral= t('admin.accounts.no_limits_imposed')
.report-card__summary
- reports.each do |report|
.report-card__summary__item
.report-card__summary__item__reported-by
- if report.account.local?
= admin_account_link_to report.account
- else
= report.account.domain
.report-card__summary__item__content
= link_to admin_report_path(report) do
.one-line= report.comment.presence || t('admin.reports.comment.none')

%span.report-card__summary__item__content__icon{ title: t('admin.accounts.statuses') }
= fa_icon('comment')
= report.statuses.count

%span.report-card__summary__item__content__icon{ title: t('admin.accounts.media_attachments') }
= fa_icon('camera')
= report.media_attachments.count

.report-card__summary__item__assigned
- if report.assigned_account.present?
= admin_account_link_to report.assigned_account
- else
\-
= paginate @reports
2 changes: 1 addition & 1 deletion app/views/settings/exports/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
%td= number_to_human_size @export.total_storage
%td
%tr
%th= t('accounts.statuses', count: @export.total_statuses)
%th= t('accounts.posts', count: @export.total_statuses)
%td= number_with_delimiter @export.total_statuses
%td
%tr
Expand Down
4 changes: 0 additions & 4 deletions config/locales/ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ ar:
comment:
none: لا شيء
created_at: ذكرت
id: معرّف ID
mark_as_resolved: إعتبار التقرير كمحلول
mark_as_unresolved: علام كغير محلولة
notes:
Expand All @@ -324,20 +323,17 @@ ar:
placeholder: قم بوصف الإجراءات التي تم اتخاذها أو أي تحديثات أخرى ذات علاقة …
reopen: إعادة فتح التقرير
report: 'التقرير #%{id}'
report_contents: المحتويات
reported_account: حساب مُبلّغ عنه
reported_by: أبلغ عنه من طرف
resolved: معالجة
resolved_msg: تم حل تقرير بنجاح!
silence_account: كتم و إخفاء الحساب
status: الحالة
suspend_account: فرض تعليق على الحساب
target: الهدف
title: التقارير
unassign: إلغاء تعيين
unresolved: غير معالجة
updated_at: محدث
view: عرض
settings:
activity_api_enabled:
desc_html: عدد المنشورات المحلية و المستخدمين النشطين و التسجيلات الأسبوعية الجديدة
Expand Down
1 change: 0 additions & 1 deletion config/locales/ast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ ast:
title: Invitaciones
reports:
are_you_sure: "¿De xuru?"
id: ID
status: Estáu
settings:
registrations:
Expand Down
4 changes: 0 additions & 4 deletions config/locales/ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ ca:
comment:
none: Cap
created_at: Reportat
id: ID
mark_as_resolved: Marca com a resolt
mark_as_unresolved: Marcar sense resoldre
notes:
Expand All @@ -333,20 +332,17 @@ ca:
placeholder: Descriu les accions que s'han pres o qualsevol altra actualització relacionada…
reopen: Reobrir informe
report: 'Informe #%{id}'
report_contents: Contingut
reported_account: Compte reportat
reported_by: Reportat per
resolved: Resolt
resolved_msg: Informe resolt amb èxit!
silence_account: Silencia el compte
status: Estat
suspend_account: Suspèn el compte
target: Objectiu
title: Informes
unassign: Treure assignació
unresolved: No resolt
updated_at: Actualitzat
view: Visualització
settings:
activity_api_enabled:
desc_html: Compte d'estatus publicats localment, usuaris actius i registres nous en períodes setmanals
Expand Down
4 changes: 0 additions & 4 deletions config/locales/co.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ co:
comment:
none: Nisunu
created_at: Palisatu
id: ID
mark_as_resolved: Indicà cum’è chjosu
mark_as_unresolved: Indicà cum’è sempre apertu
notes:
Expand All @@ -333,20 +332,17 @@ co:
placeholder: Per parlà di l’azzione pigliate, o altre messe à ghjornu nant’à u signalamentu…
reopen: Riapre u signalamentu
report: 'Signalamente #%{id}'
report_contents: Cuntenuti
reported_account: Contu palisatu
reported_by: Palisatu da
resolved: Scioltu è chjosu
resolved_msg: Signalamentu scioltu!
silence_account: Silenzà u contu
status: Statutu
suspend_account: Suspende u contu
target: Oggettu
title: Signalamenti
unassign: Disassignà
unresolved: Micca sciolti
updated_at: Messi à ghjornu
view: Vede
settings:
activity_api_enabled:
desc_html: Numeri di statuti creati quì, utilizatori attivi, è arregistramenti novi tutte e settimane
Expand Down
4 changes: 0 additions & 4 deletions config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ cs:
comment:
none: Žádné
created_at: Nahlášené
id: ID
mark_as_resolved: Označit jako vyřešené
mark_as_unresolved: Označit jako nevyřešené
notes:
Expand All @@ -333,20 +332,17 @@ cs:
placeholder: Popište, jaké akce byly vykonány, nebo jakékoliv jiné související aktuality...
reopen: Znovu otevřít nahlášení
report: 'Nahlásit #%{id}'
report_contents: Obsah
reported_account: Nahlášený účet
reported_by: Nahlášeno uživatelem
resolved: Vyřešeno
resolved_msg: Nahlášení úspěšně vyřešeno!
silence_account: Utišit účet
status: Stav
suspend_account: Suspendovat účet
target: Cíl
title: Nahlášení
unassign: Odebrat
unresolved: Nevyřešeno
updated_at: Aktualizováno
view: Zobrazit
settings:
activity_api_enabled:
desc_html: Počty lokálně publikovaných příspěvků, aktivních uživatelů a nových registrací, v týdenních intervalech
Expand Down
Loading

0 comments on commit b4c7a2e

Please sign in to comment.