From 9d4541c612b506889675c4c19ced5cd17ad3710f Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 12 Oct 2018 04:04:08 +0200 Subject: Display customized mascot in web UI and fix admin form for it (#8964) Follow-up to #8766 --- app/views/admin/settings/edit.html.haml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/views/admin') diff --git a/app/views/admin/settings/edit.html.haml b/app/views/admin/settings/edit.html.haml index f3f9bdaf0..04b1a6754 100644 --- a/app/views/admin/settings/edit.html.haml +++ b/app/views/admin/settings/edit.html.haml @@ -26,6 +26,8 @@ = f.input :thumbnail, as: :file, wrapper: :with_block_label, label: t('admin.settings.thumbnail.title'), hint: t('admin.settings.thumbnail.desc_html') .fields-row__column.fields-row__column-6.fields-group = f.input :hero, as: :file, wrapper: :with_block_label, label: t('admin.settings.hero.title'), hint: t('admin.settings.hero.desc_html') + + .fields-row .fields-row__column.fields-row__column-6.fields-group = f.input :mascot, as: :file, wrapper: :with_block_label, label: t('admin.settings.mascot.title'), hint: t('admin.settings.mascot.desc_html') -- cgit From 9486f0ca7774a148845a45db74ae8527cc963e85 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 20 Oct 2018 02:39:39 +0200 Subject: Add "disable" button to report screen (#9024) * Add "disable" button to report screen * i18n-tasks remove-unused --- app/controllers/admin/reports_controller.rb | 9 +++++++++ app/views/admin/accounts/show.html.haml | 6 +++--- app/views/admin/reports/show.html.haml | 6 ++++-- config/locales/ar.yml | 2 -- config/locales/ca.yml | 2 -- config/locales/co.yml | 2 -- config/locales/cs.yml | 2 -- config/locales/cy.yml | 1 - config/locales/da.yml | 2 -- config/locales/de.yml | 2 -- config/locales/el.yml | 2 -- config/locales/en.yml | 4 +--- config/locales/eo.yml | 2 -- config/locales/es.yml | 2 -- config/locales/eu.yml | 2 -- config/locales/fa.yml | 2 -- config/locales/fi.yml | 2 -- config/locales/fr.yml | 2 -- config/locales/gl.yml | 2 -- config/locales/he.yml | 2 -- config/locales/hu.yml | 2 -- config/locales/id.yml | 2 -- config/locales/io.yml | 2 -- config/locales/it.yml | 2 -- config/locales/ja.yml | 2 -- config/locales/ka.yml | 2 -- config/locales/ko.yml | 2 -- config/locales/nl.yml | 2 -- config/locales/no.yml | 2 -- config/locales/oc.yml | 3 --- config/locales/pl.yml | 2 -- config/locales/pt-BR.yml | 2 -- config/locales/pt.yml | 2 -- config/locales/ru.yml | 2 -- config/locales/sk.yml | 2 -- config/locales/sr-Latn.yml | 2 -- config/locales/sr.yml | 2 -- config/locales/sv.yml | 2 -- config/locales/th.yml | 2 -- config/locales/tr.yml | 2 -- config/locales/uk.yml | 2 -- config/locales/zh-CN.yml | 2 -- config/locales/zh-HK.yml | 2 -- config/locales/zh-TW.yml | 2 -- 44 files changed, 17 insertions(+), 88 deletions(-) (limited to 'app/views/admin') diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index 5d7f43e00..e97ddb9b6 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -44,6 +44,14 @@ module Admin when 'resolve' @report.resolve!(current_account) log_action :resolve, @report + when 'disable' + @report.resolve!(current_account) + @report.target_account.user.disable! + + log_action :resolve, @report + log_action :disable, @report.target_account.user + + resolve_all_target_account_reports when 'silence' @report.resolve!(current_account) @report.target_account.update!(silenced: true) @@ -55,6 +63,7 @@ module Admin else raise ActiveRecord::RecordNotFound end + @report.reload end diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index f2c53e3fe..17f1f224d 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -106,7 +106,7 @@ - if @account.user&.otp_required_for_login? = link_to t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(@account.user.id), method: :delete, class: 'button' if can?(:disable_2fa, @account.user) - unless @account.memorial? - = link_to t('admin.accounts.memorialize'), memorialize_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button' if can?(:memorialize, @account) + = link_to t('admin.accounts.memorialize'), memorialize_admin_account_path(@account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') }, class: 'button button--destructive' if can?(:memorialize, @account) - else = link_to t('admin.accounts.redownload'), redownload_admin_account_path(@account.id), method: :post, class: 'button' if can?(:redownload, @account) @@ -114,7 +114,7 @@ - if @account.silenced? = link_to t('admin.accounts.undo_silenced'), admin_account_silence_path(@account.id), method: :delete, class: 'button' if can?(:unsilence, @account) - else - = link_to t('admin.accounts.silence'), admin_account_silence_path(@account.id), method: :post, class: 'button' if can?(:silence, @account) + = link_to t('admin.accounts.silence'), admin_account_silence_path(@account.id), method: :post, class: 'button button--destructive' if can?(:silence, @account) - if @account.local? - unless @account.user_confirmed? @@ -123,7 +123,7 @@ - if @account.suspended? = link_to t('admin.accounts.undo_suspension'), admin_account_suspension_path(@account.id), method: :delete, class: 'button' if can?(:unsuspend, @account) - else - = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@account.id), class: 'button' if can?(:suspend, @account) + = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@account.id), class: 'button button--destructive' if can?(:suspend, @account) - if !@account.local? && @account.hub_url.present? %hr.spacer/ diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index ef0e4aa41..3588d151d 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -7,8 +7,10 @@ %div{ style: 'overflow: hidden; margin-bottom: 20px' } - if @report.unresolved? %div{ style: 'float: right' } - = link_to t('admin.reports.silence_account'), admin_report_path(@report, outcome: 'silence'), method: :put, class: 'button' - = link_to t('admin.reports.suspend_account'), new_admin_account_suspension_path(@report.target_account_id, report_id: @report.id), class: 'button' + - if @report.target_account.local? + = link_to t('admin.accounts.disable'), admin_report_path(@report, outcome: 'disable'), method: :put, class: 'button button--destructive' + = link_to t('admin.accounts.silence'), admin_report_path(@report, outcome: 'silence'), method: :put, class: 'button button--destructive' + = link_to t('admin.accounts.perform_full_suspension'), new_admin_account_suspension_path(@report.target_account_id, report_id: @report.id), class: 'button button--destructive' %div{ style: 'float: left' } = link_to t('admin.reports.mark_as_resolved'), admin_report_path(@report, outcome: 'resolve'), method: :put, class: 'button' - else diff --git a/config/locales/ar.yml b/config/locales/ar.yml index 0a8d3fdd4..4499830f9 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -346,9 +346,7 @@ ar: reported_by: أبلغ عنه من طرف resolved: معالجة resolved_msg: تم حل تقرير بنجاح! - silence_account: كتم و إخفاء الحساب status: الحالة - suspend_account: فرض تعليق على الحساب title: التقارير unassign: إلغاء تعيين unresolved: غير معالجة diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 354d45713..d7211f654 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -336,9 +336,7 @@ ca: 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 title: Informes unassign: Treure assignació unresolved: No resolt diff --git a/config/locales/co.yml b/config/locales/co.yml index 0eac457e8..7b810e2ed 100644 --- a/config/locales/co.yml +++ b/config/locales/co.yml @@ -345,9 +345,7 @@ co: reported_by: Palisatu da resolved: Scioltu è chjosu resolved_msg: Signalamentu scioltu! - silence_account: Silenzà u contu status: Statutu - suspend_account: Suspende u contu title: Signalamenti unassign: Disassignà unresolved: Micca sciolti diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 2ab2beec5..67bda70f1 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -345,9 +345,7 @@ cs: 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 title: Nahlášení unassign: Odebrat unresolved: Nevyřešeno diff --git a/config/locales/cy.yml b/config/locales/cy.yml index 88aa3ee56..8b16949a5 100644 --- a/config/locales/cy.yml +++ b/config/locales/cy.yml @@ -329,7 +329,6 @@ cy: reported_by: Adroddwyd gan resolved: Wedi ei ddatrys resolved_msg: Llwyddwyd i ddatrys yr adroddiad! - silence_account: Tawelwch y cyfrif status: Statws title: Adroddiadau unassign: Dadneilltuo diff --git a/config/locales/da.yml b/config/locales/da.yml index 7cda5cbca..0cd3e78f7 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -336,9 +336,7 @@ da: reported_by: Anmeldt af resolved: Løst resolved_msg: Anmeldelse er sat til at være løst! - silence_account: Dæmp konto status: Status - suspend_account: Udeluk konto title: Anmeldelser unassign: Utildel unresolved: Uløst diff --git a/config/locales/de.yml b/config/locales/de.yml index fb0235e0c..12e015226 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -344,9 +344,7 @@ de: reported_by: Gemeldet von resolved: Gelöst resolved_msg: Meldung erfolgreich gelöst! - silence_account: Konto stummschalten status: Status - suspend_account: Konto sperren title: Meldungen unassign: Zuweisung entfernen unresolved: Ungelöst diff --git a/config/locales/el.yml b/config/locales/el.yml index 63c438a93..fbd8a6461 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -345,9 +345,7 @@ el: reported_by: Αναφέρθηκε από resolved: Επιλύθηκε resolved_msg: Η καταγγελία επιλύθηκε επιτυχώς! - silence_account: Αποσιώπηση λογαριασμού status: Κατάσταση - suspend_account: Ανέστειλε λογαριασμό title: Αναφορές unassign: Αποσύνδεση unresolved: Άλυτη diff --git a/config/locales/en.yml b/config/locales/en.yml index 26fe0080d..0360e719e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -128,7 +128,7 @@ en: most_recent: Most recent title: Order outbox_url: Outbox URL - perform_full_suspension: Perform full suspension + perform_full_suspension: Suspend profile_url: Profile URL promote: Promote protocol: Protocol @@ -346,9 +346,7 @@ en: reported_by: Reported by resolved: Resolved resolved_msg: Report successfully resolved! - silence_account: Silence account status: Status - suspend_account: Suspend account title: Reports unassign: Unassign unresolved: Unresolved diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 454eeae9d..72628a944 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -325,9 +325,7 @@ eo: reported_by: Signalita de resolved: Solvita resolved_msg: Signalo sukcese solvita! - silence_account: Kaŝi konton status: Mesaĝoj - suspend_account: Haltigi konton title: Signaloj unassign: Malasigni unresolved: Nesolvita diff --git a/config/locales/es.yml b/config/locales/es.yml index 5adfafeca..ccb7439ae 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -336,9 +336,7 @@ es: reported_by: Reportado por resolved: Resuelto resolved_msg: "¡La denuncia se ha resuelto correctamente!" - silence_account: Silenciar cuenta status: Estado - suspend_account: Suspender cuenta title: Reportes unassign: Desasignar unresolved: No resuelto diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 1a6558d9f..f0ddb6adb 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -336,9 +336,7 @@ eu: reported_by: Salatzailea resolved: Konponduta resolved_msg: Salaketa ongi konpondu da! - silence_account: Isilarazi kontua status: Mezua - suspend_account: Kanporatu kontua title: Salaketak unassign: Kendu esleipena unresolved: Konpondu gabea diff --git a/config/locales/fa.yml b/config/locales/fa.yml index d620dcf4b..a9cf5868f 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -336,9 +336,7 @@ fa: reported_by: گزارش از طرف resolved: حل‌شده resolved_msg: گزارش با موفقیت حل شد! - silence_account: بی‌صدا کردن حساب status: نوشته - suspend_account: معلق‌کردن حساب title: گزارش‌ها unassign: پس‌گرفتن مسئولیت unresolved: حل‌نشده diff --git a/config/locales/fi.yml b/config/locales/fi.yml index c4d1dd871..e62931129 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -282,9 +282,7 @@ fi: reported_by: Raportoija resolved: Ratkaistut resolved_msg: Raportti onnistuneesti ratkaistu! - silence_account: Hiljennä tili status: Tila - suspend_account: Siirrä tili jäähylle title: Raportit unresolved: Ratkaisemattomat updated_at: Päivitetty diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 51a308553..f0eaf8d3f 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -345,9 +345,7 @@ fr: reported_by: Signalé par resolved: Résolus resolved_msg: Signalement résolu avec succès ! - silence_account: Masquer le compte status: Statut - suspend_account: Suspendre le compte title: Signalements unassign: Dés-assigner unresolved: Non résolus diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 49cc94f30..090796413 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -345,9 +345,7 @@ gl: reported_by: Reportada por resolved: Resolto resolved_msg: Resolveuse con éxito o informe! - silence_account: Acalar conta status: Estado - suspend_account: Suspender conta title: Informes unassign: Non asignar unresolved: Non resolto diff --git a/config/locales/he.yml b/config/locales/he.yml index 3d24f22d2..09d57da3b 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -189,9 +189,7 @@ he: reported_account: חשבון מדווח reported_by: דווח על ידי resolved: פתור - silence_account: השתקת חשבון status: הודעה - suspend_account: השעיית חשבון title: דיווחים unresolved: לא פתור settings: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 0c4046785..92d11f0d8 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -249,9 +249,7 @@ hu: reported_account: Bejelentett fiók reported_by: 'Jelentette:' resolved: Megoldott - silence_account: Felhasználó némítása status: Állapot - suspend_account: Felhasználó felfüggesztése title: Jelentések unresolved: Megoldatlan settings: diff --git a/config/locales/id.yml b/config/locales/id.yml index b186b7652..3da3583f6 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -114,9 +114,7 @@ id: reported_account: Akun yang dilaporkan reported_by: Dilaporkan oleh resolved: Terseleseikan - silence_account: Akun yang didiamkan status: Status - suspend_account: Akun yang disuspen title: Laporan unresolved: Belum Terseleseikan settings: diff --git a/config/locales/io.yml b/config/locales/io.yml index be8a87acd..b739df3af 100644 --- a/config/locales/io.yml +++ b/config/locales/io.yml @@ -107,9 +107,7 @@ io: reported_account: Reported account reported_by: Reported by resolved: Resolved - silence_account: Silence account status: Status - suspend_account: Suspend account title: Reports unresolved: Unresolved settings: diff --git a/config/locales/it.yml b/config/locales/it.yml index 5182e3372..6a831ab2c 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -324,9 +324,7 @@ it: report: 'Rapporto #%{id}' reported_by: Inviato da resolved: Risolto - silence_account: Silenzia account status: Stato - suspend_account: Sospendi account title: Rapporti unassign: Non assegnare unresolved: Non risolto diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 84426f84e..ea1d665da 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -346,9 +346,7 @@ ja: reported_by: 報告者 resolved: 解決済み resolved_msg: レポートを解決済みにしました! - silence_account: アカウントをサイレンス status: ステータス - suspend_account: アカウントを停止 title: レポート unassign: 担当を外す unresolved: 未解決 diff --git a/config/locales/ka.yml b/config/locales/ka.yml index f782db09b..5ac254df4 100644 --- a/config/locales/ka.yml +++ b/config/locales/ka.yml @@ -325,9 +325,7 @@ ka: reported_by: დაარეპორტა resolved: გადაწყვეტილი resolved_msg: რეპორტი წარმატებით გადაწყდა! - silence_account: ანგარიშის გაჩუმება status: სტატუსი - suspend_account: ანგარიშის შეჩერება title: რეპორტები unassign: გადაყენება unresolved: გადაუწყვეტელი diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 6f281a302..9f9875a16 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -338,9 +338,7 @@ ko: reported_by: 신고자 resolved: 해결됨 resolved_msg: 리포트가 성공적으로 해결되었습니다! - silence_account: 계정을 침묵 처리 status: 상태 - suspend_account: 계정을 정지 title: 신고 unassign: 할당 해제 unresolved: 미해결 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 7e206d938..997df0164 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -336,9 +336,7 @@ nl: reported_by: Gerapporteerd door resolved: Opgelost resolved_msg: Rapportage succesvol opgelost! - silence_account: Account negeren status: Toot - suspend_account: Account opschorten title: Rapportages unassign: Niet langer toewijzen unresolved: Onopgelost diff --git a/config/locales/no.yml b/config/locales/no.yml index bbfa9b5da..61466fa20 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -249,9 +249,7 @@ reported_account: Rapportert konto reported_by: Rapportert av resolved: Løst - silence_account: Målbind konto status: Status - suspend_account: Utvis konto title: Rapporter unresolved: Uløst settings: diff --git a/config/locales/oc.yml b/config/locales/oc.yml index af11d18e4..01063ab57 100644 --- a/config/locales/oc.yml +++ b/config/locales/oc.yml @@ -144,7 +144,6 @@ oc: role: Permissions roles: admin: Administrator - bot: Robòt moderator: Moderador staff: Personnal user: Uitlizaire @@ -337,9 +336,7 @@ oc: reported_by: Senhalat per resolved: Resolgut resolved_msg: Rapòrt corrèctament resolgut  ! - silence_account: Metre lo compte en silenci status: Estatut - suspend_account: Suspendre lo compte title: Senhalament unassign: Levar unresolved: Pas resolgut diff --git a/config/locales/pl.yml b/config/locales/pl.yml index dfebe25bd..4921055e3 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -354,9 +354,7 @@ pl: reported_by: Zgłaszający resolved: Rozwiązane resolved_msg: Pomyślnie rozwiązano zgłoszenie. - silence_account: Wycisz konto status: Stan - suspend_account: Zawieś konto title: Zgłoszenia unassign: Cofnij przypisanie unresolved: Nierozwiązane diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 3e56f0731..1ec00f85f 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -334,9 +334,7 @@ pt-BR: reported_by: Denunciada por resolved: Resolvido resolved_msg: Denúncia resolvida com sucesso! - silence_account: Silenciar conta status: Status - suspend_account: Suspender conta title: Denúncias unassign: Desatribuir unresolved: Não resolvido diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 2bada74fe..5f532ea37 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -249,9 +249,7 @@ pt: reported_account: Conta denunciada reported_by: Denúnciada por resolved: Resolvido - silence_account: Conta silenciada status: Estado - suspend_account: Conta suspensa title: Denúncias unresolved: Por resolver settings: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index e8bbb94ca..2eef00170 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -345,9 +345,7 @@ ru: reported_by: Отправитель жалобы resolved: Разрешено resolved_msg: Жалоба успешно обработана! - silence_account: Заглушить аккаунт status: Статус - suspend_account: Блокировать аккаунт title: Жалобы unassign: Снять назначение unresolved: Неразрешенные diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 3e337fa42..2bdd3afa6 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -337,9 +337,7 @@ sk: reported_by: Nahlásené užívateľom resolved: Vyriešené resolved_msg: Hlásenie úspešne vyriešené! - silence_account: Zamĺčať účet status: Stav - suspend_account: Pozastaviť účet title: Reporty unassign: Odobrať unresolved: Nevyriešené diff --git a/config/locales/sr-Latn.yml b/config/locales/sr-Latn.yml index d6800a8fb..ff31203c8 100644 --- a/config/locales/sr-Latn.yml +++ b/config/locales/sr-Latn.yml @@ -251,9 +251,7 @@ sr-Latn: reported_account: Prijavljeni nalog reported_by: Prijavio resolved: Rešeni - silence_account: Ućutkaj nalog status: Status - suspend_account: Suspenduj nalog title: Prijave unresolved: Nerešeni settings: diff --git a/config/locales/sr.yml b/config/locales/sr.yml index 53981b0f0..36d81886e 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -338,9 +338,7 @@ sr: reported_by: Пријавио resolved: Решена resolved_msg: Пријава успешно разрешена! - silence_account: Ућуткај налог status: Статус - suspend_account: Суспендуј налог title: Пријаве unassign: Уклони доделу unresolved: Нерешене diff --git a/config/locales/sv.yml b/config/locales/sv.yml index b7229aebe..4f80a46f1 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -285,9 +285,7 @@ sv: reported_by: Anmäld av resolved: Löst resolved_msg: Anmälan har lösts framgångsrikt! - silence_account: Tysta ner konto status: Status - suspend_account: Suspendera konto title: Anmälningar unassign: Otilldela unresolved: Olösta diff --git a/config/locales/th.yml b/config/locales/th.yml index 8c411f252..3ed73c7f5 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -116,9 +116,7 @@ th: reported_account: รายงานแอคเคาท์ reported_by: รายงานโดย resolved: จัดการแล้ว - silence_account: แอคเค๊าท์ที่ปิดเสียง status: สถานะ - suspend_account: แอคเค๊าท์ที่หยุดไว้ title: รายงาน unresolved: Unresolved settings: diff --git a/config/locales/tr.yml b/config/locales/tr.yml index d7ecb480f..99ba89397 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -115,9 +115,7 @@ tr: reported_account: Şikayet edilen hesap reported_by: Şikayet eden resolved: Giderildi - silence_account: Hesabı sustur status: Durum - suspend_account: Hesabı uzaklaştır title: Şikayetler unresolved: Giderilmedi settings: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 22d5e98df..83a315a37 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -313,9 +313,7 @@ uk: reported_by: Відправник скарги resolved: Вирішено resolved_msg: Скаргу успішно вирішено! - silence_account: Заглушити акаунт status: Статус - suspend_account: Заблокувати акаунт title: Скарги unassign: Зняти призначення unresolved: Невирішені diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 9a1b47fdb..0ce1a0ed7 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -332,9 +332,7 @@ zh-CN: reported_by: 举报人 resolved: 已处理 resolved_msg: 举报处理成功! - silence_account: 隐藏用户 status: 状态 - suspend_account: 封禁用户 title: 举报 unassign: 取消接管 unresolved: 未处理 diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index abbb1b809..db7c0c47c 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -285,9 +285,7 @@ zh-HK: reported_by: 舉報者 resolved: 已處理 resolved_msg: 舉報已處理。 - silence_account: 將用戶靜音 status: 狀態 - suspend_account: 將用戶停權 title: 舉報 unassign: 取消指派 unresolved: 未處理 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 338c40d09..d1b7633f3 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -295,9 +295,7 @@ zh-TW: reported_by: 檢舉人 resolved: 已解決 resolved_msg: 檢舉已處理! - silence_account: 靜音使用者 status: 狀態 - suspend_account: 停權使用者 title: 檢舉 unassign: 取消指派 unresolved: 未解決 -- cgit From fd5285658f477c5b6a9c7af0935b5c889729b2e0 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 20 Oct 2018 08:02:44 +0200 Subject: Add option to block reports from domain (#8830) --- app/controllers/admin/domain_blocks_controller.rb | 2 +- app/javascript/packs/admin.js | 21 ++++++++------------- app/lib/activitypub/activity/flag.rb | 8 ++++++++ app/models/domain_block.rb | 13 +++++++------ .../admin/domain_blocks/_domain_block.html.haml | 5 ++++- app/views/admin/domain_blocks/index.html.haml | 1 + app/views/admin/domain_blocks/new.html.haml | 3 +++ .../_email_domain_block.html.haml | 2 +- app/views/admin/instances/_instance.html.haml | 2 +- config/locales/en.yml | 2 ++ ...017170937_add_reject_reports_to_domain_blocks.rb | 17 +++++++++++++++++ db/schema.rb | 1 + 12 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb (limited to 'app/views/admin') diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb index 64de2cbf0..90c70275a 100644 --- a/app/controllers/admin/domain_blocks_controller.rb +++ b/app/controllers/admin/domain_blocks_controller.rb @@ -46,7 +46,7 @@ module Admin end def resource_params - params.require(:domain_block).permit(:domain, :severity, :reject_media, :retroactive) + params.require(:domain_block).permit(:domain, :severity, :reject_media, :reject_reports, :retroactive) end def retroactive_unblock? diff --git a/app/javascript/packs/admin.js b/app/javascript/packs/admin.js index ce5f70ee7..f0c0ee0b7 100644 --- a/app/javascript/packs/admin.js +++ b/app/javascript/packs/admin.js @@ -1,17 +1,5 @@ import { delegate } from 'rails-ujs'; -function handleDeleteStatus(event) { - const [data] = event.detail; - const element = document.querySelector(`[data-id="${data.id}"]`); - if (element) { - element.parentNode.removeChild(element); - } -} - -[].forEach.call(document.querySelectorAll('.trash-button'), (content) => { - content.addEventListener('ajax:success', handleDeleteStatus); -}); - const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]'; delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { @@ -22,6 +10,7 @@ delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { delegate(document, batchCheckboxClassName, 'change', () => { const checkAllElement = document.querySelector('#batch_checkbox_all'); + if (checkAllElement) { checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); @@ -41,8 +30,14 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => { }); delegate(document, '#domain_block_severity', 'change', ({ target }) => { - const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports'); + if (rejectMediaDiv) { rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; } + + if (rejectReportsDiv) { + rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; + } }); diff --git a/app/lib/activitypub/activity/flag.rb b/app/lib/activitypub/activity/flag.rb index 36d3c5730..92e59bb81 100644 --- a/app/lib/activitypub/activity/flag.rb +++ b/app/lib/activitypub/activity/flag.rb @@ -2,6 +2,8 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity def perform + return if skip_reports? + target_accounts = object_uris.map { |uri| account_from_uri(uri) }.compact.select(&:local?) target_statuses_by_account = object_uris.map { |uri| status_from_uri(uri) }.compact.select(&:local?).group_by(&:account_id) @@ -19,6 +21,12 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity end end + private + + def skip_reports? + DomainBlock.find_by(domain: @account.domain)&.reject_reports? + end + def object_uris @object_uris ||= Array(@object.is_a?(Array) ? @object.map { |item| value_or_id(item) } : value_or_id(@object)) end diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index 93658793b..b828a9d71 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -3,12 +3,13 @@ # # Table name: domain_blocks # -# id :bigint(8) not null, primary key -# domain :string default(""), not null -# created_at :datetime not null -# updated_at :datetime not null -# severity :integer default("silence") -# reject_media :boolean default(FALSE), not null +# id :bigint(8) not null, primary key +# domain :string default(""), not null +# created_at :datetime not null +# updated_at :datetime not null +# severity :integer default("silence") +# reject_media :boolean default(FALSE), not null +# reject_reports :boolean default(FALSE), not null # class DomainBlock < ApplicationRecord diff --git a/app/views/admin/domain_blocks/_domain_block.html.haml b/app/views/admin/domain_blocks/_domain_block.html.haml index 17a3de81c..7bfea3574 100644 --- a/app/views/admin/domain_blocks/_domain_block.html.haml +++ b/app/views/admin/domain_blocks/_domain_block.html.haml @@ -1,10 +1,13 @@ %tr - %td.domain + %td %samp= domain_block.domain %td.severity = t("admin.domain_blocks.severities.#{domain_block.severity}") %td.reject_media - if domain_block.reject_media? || domain_block.suspend? %i.fa.fa-check + %td.reject_reports + - if domain_block.reject_reports? || domain_block.suspend? + %i.fa.fa-check %td = table_link_to 'undo', t('admin.domain_blocks.undo'), admin_domain_block_path(domain_block) diff --git a/app/views/admin/domain_blocks/index.html.haml b/app/views/admin/domain_blocks/index.html.haml index 42b8ca53f..4c5221c42 100644 --- a/app/views/admin/domain_blocks/index.html.haml +++ b/app/views/admin/domain_blocks/index.html.haml @@ -8,6 +8,7 @@ %th= t('admin.domain_blocks.domain') %th= t('admin.domain_blocks.severity') %th= t('admin.domain_blocks.reject_media') + %th= t('admin.domain_blocks.reject_reports') %th %tbody = render @domain_blocks diff --git a/app/views/admin/domain_blocks/new.html.haml b/app/views/admin/domain_blocks/new.html.haml index f0eb217eb..055d2fbd7 100644 --- a/app/views/admin/domain_blocks/new.html.haml +++ b/app/views/admin/domain_blocks/new.html.haml @@ -17,5 +17,8 @@ .fields-group = f.input :reject_media, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_media'), hint: I18n.t('admin.domain_blocks.reject_media_hint') + .fields-group + = f.input :reject_reports, as: :boolean, wrapper: :with_label, label: I18n.t('admin.domain_blocks.reject_reports'), hint: I18n.t('admin.domain_blocks.reject_reports_hint') + .actions = f.button :button, t('.create'), type: :submit diff --git a/app/views/admin/email_domain_blocks/_email_domain_block.html.haml b/app/views/admin/email_domain_blocks/_email_domain_block.html.haml index 61cff9395..bf66c9001 100644 --- a/app/views/admin/email_domain_blocks/_email_domain_block.html.haml +++ b/app/views/admin/email_domain_blocks/_email_domain_block.html.haml @@ -1,5 +1,5 @@ %tr - %td.domain + %td %samp= email_domain_block.domain %td = table_link_to 'trash', t('admin.email_domain_blocks.delete'), admin_email_domain_block_path(email_domain_block), method: :delete diff --git a/app/views/admin/instances/_instance.html.haml b/app/views/admin/instances/_instance.html.haml index 6efbbbe60..e36ebae47 100644 --- a/app/views/admin/instances/_instance.html.haml +++ b/app/views/admin/instances/_instance.html.haml @@ -1,5 +1,5 @@ %tr - %td.domain + %td = link_to instance.domain, admin_accounts_path(by_domain: instance.domain) %td.count = instance.accounts_count diff --git a/config/locales/en.yml b/config/locales/en.yml index 0360e719e..a2859aa5d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -263,6 +263,8 @@ en: title: New domain block reject_media: Reject media files reject_media_hint: Removes locally stored media files and refuses to download any in the future. Irrelevant for suspensions + reject_reports: Reject reports + reject_reports_hint: Ignore all reports coming from this domain. Irrelevant for suspensions severities: noop: None silence: Silence diff --git a/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb b/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb new file mode 100644 index 000000000..f05d50fcd --- /dev/null +++ b/db/migrate/20181017170937_add_reject_reports_to_domain_blocks.rb @@ -0,0 +1,17 @@ +require Rails.root.join('lib', 'mastodon', 'migration_helpers') + +class AddRejectReportsToDomainBlocks < ActiveRecord::Migration[5.2] + include Mastodon::MigrationHelpers + + disable_ddl_transaction! + + def up + safety_assured do + add_column_with_default :domain_blocks, :reject_reports, :boolean, default: false, allow_null: false + end + end + + def down + remove_column :domain_blocks, :reject_reports + end +end diff --git a/db/schema.rb b/db/schema.rb index 046975ac9..8facfa259 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -186,6 +186,7 @@ ActiveRecord::Schema.define(version: 2018_10_18_205649) do t.datetime "updated_at", null: false t.integer "severity", default: 0 t.boolean "reject_media", default: false, null: false + t.boolean "reject_reports", default: false, null: false t.index ["domain"], name: "index_domain_blocks_on_domain", unique: true end -- cgit