Add force CW action button on moderatoring statuses
This commit is contained in:
parent
8837193537
commit
a6a68a548f
8 changed files with 64 additions and 3 deletions
|
@ -12,7 +12,7 @@ class Admin::Reports::ActionsController < Admin::BaseController
|
||||||
authorize @report, :show?
|
authorize @report, :show?
|
||||||
|
|
||||||
case action_from_button
|
case action_from_button
|
||||||
when 'delete', 'mark_as_sensitive'
|
when 'delete', 'mark_as_sensitive', 'force_cw'
|
||||||
status_batch_action = Admin::StatusBatchAction.new(
|
status_batch_action = Admin::StatusBatchAction.new(
|
||||||
type: action_from_button,
|
type: action_from_button,
|
||||||
status_ids: @report.status_ids,
|
status_ids: @report.status_ids,
|
||||||
|
@ -52,6 +52,8 @@ class Admin::Reports::ActionsController < Admin::BaseController
|
||||||
'delete'
|
'delete'
|
||||||
elsif params[:mark_as_sensitive]
|
elsif params[:mark_as_sensitive]
|
||||||
'mark_as_sensitive'
|
'mark_as_sensitive'
|
||||||
|
elsif params[:force_cw]
|
||||||
|
'force_cw'
|
||||||
elsif params[:silence]
|
elsif params[:silence]
|
||||||
'silence'
|
'silence'
|
||||||
elsif params[:suspend]
|
elsif params[:suspend]
|
||||||
|
|
|
@ -473,8 +473,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_references!
|
def process_references!
|
||||||
ActivityPub::FetchReferencesService(@json['references']) unless @json['references'].nil?
|
references = @json['references'].nil? ? [] : ActivityPub::FetchReferencesService(@json['references'])
|
||||||
ProcessReferencesWorker.perform_async(@status.id, [], [])
|
ProcessReferencesWorker.perform_async(@status.id, [], references)
|
||||||
end
|
end
|
||||||
|
|
||||||
def join_group!
|
def join_group!
|
||||||
|
|
|
@ -20,6 +20,7 @@ class AccountWarning < ApplicationRecord
|
||||||
enum action: {
|
enum action: {
|
||||||
none: 0,
|
none: 0,
|
||||||
disable: 1_000,
|
disable: 1_000,
|
||||||
|
force_cw: 1_200,
|
||||||
mark_statuses_as_sensitive: 1_250,
|
mark_statuses_as_sensitive: 1_250,
|
||||||
delete_statuses: 1_500,
|
delete_statuses: 1_500,
|
||||||
sensitive: 2_000,
|
sensitive: 2_000,
|
||||||
|
|
|
@ -33,6 +33,8 @@ class Admin::StatusBatchAction
|
||||||
handle_delete!
|
handle_delete!
|
||||||
when 'mark_as_sensitive'
|
when 'mark_as_sensitive'
|
||||||
handle_mark_as_sensitive!
|
handle_mark_as_sensitive!
|
||||||
|
when 'force_cw'
|
||||||
|
handle_force_cw!
|
||||||
when 'report'
|
when 'report'
|
||||||
handle_report!
|
handle_report!
|
||||||
when 'remove_from_report'
|
when 'remove_from_report'
|
||||||
|
@ -104,6 +106,42 @@ class Admin::StatusBatchAction
|
||||||
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
|
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def handle_force_cw!
|
||||||
|
representative_account = Account.representative
|
||||||
|
|
||||||
|
# Can't use a transaction here because UpdateStatusService queues
|
||||||
|
# Sidekiq jobs
|
||||||
|
statuses.find_each do |status|
|
||||||
|
authorize([:admin, status], :update?)
|
||||||
|
|
||||||
|
status_text = status.text
|
||||||
|
status_text = "#{status.spoiler_text}\n\n#{status_text}" if status.spoiler_text
|
||||||
|
|
||||||
|
if target_account.local?
|
||||||
|
UpdateStatusService.new.call(status, representative_account.id, spoiler_text: 'CW', text: status_text)
|
||||||
|
else
|
||||||
|
status.update(spoiler_text: 'CW', text: status_text)
|
||||||
|
end
|
||||||
|
|
||||||
|
log_action(:update, status)
|
||||||
|
|
||||||
|
if with_report?
|
||||||
|
report.resolve!(current_account)
|
||||||
|
log_action(:resolve, report)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@warning = target_account.strikes.create!(
|
||||||
|
action: :force_cw,
|
||||||
|
account: current_account,
|
||||||
|
report: report,
|
||||||
|
status_ids: status_ids,
|
||||||
|
text: text
|
||||||
|
)
|
||||||
|
|
||||||
|
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
|
||||||
|
end
|
||||||
|
|
||||||
def handle_report!
|
def handle_report!
|
||||||
@report = Report.new(report_params) unless with_report?
|
@report = Report.new(report_params) unless with_report?
|
||||||
@report.status_ids = (@report.status_ids + allowed_status_ids).uniq
|
@report.status_ids = (@report.status_ids + allowed_status_ids).uniq
|
||||||
|
|
|
@ -29,6 +29,8 @@ class ApproveAppealService < BaseService
|
||||||
undo_delete_statuses!
|
undo_delete_statuses!
|
||||||
when 'mark_statuses_as_sensitive'
|
when 'mark_statuses_as_sensitive'
|
||||||
undo_mark_statuses_as_sensitive!
|
undo_mark_statuses_as_sensitive!
|
||||||
|
when 'force_cw'
|
||||||
|
undo_force_cw!
|
||||||
when 'sensitive'
|
when 'sensitive'
|
||||||
undo_sensitive!
|
undo_sensitive!
|
||||||
when 'silence'
|
when 'silence'
|
||||||
|
@ -58,6 +60,13 @@ class ApproveAppealService < BaseService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def undo_force_cw!
|
||||||
|
representative_account = Account.representative
|
||||||
|
@strike.statuses.includes(:media_attachments).each do |status|
|
||||||
|
UpdateStatusService.new.call(status, representative_account.id, spoiler_text: '')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def undo_sensitive!
|
def undo_sensitive!
|
||||||
target_account.unsensitize!
|
target_account.unsensitize!
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
= button_tag t('admin.reports.mark_as_sensitive'), name: :mark_as_sensitive, class: 'button'
|
= button_tag t('admin.reports.mark_as_sensitive'), name: :mark_as_sensitive, class: 'button'
|
||||||
.report-actions__item__description
|
.report-actions__item__description
|
||||||
= t('admin.reports.actions.mark_as_sensitive_description_html')
|
= t('admin.reports.actions.mark_as_sensitive_description_html')
|
||||||
|
.report-actions__item
|
||||||
|
.report-actions__item__button
|
||||||
|
= button_tag t('admin.reports.force_cw'), name: :force_cw, class: 'button'
|
||||||
|
.report-actions__item__description
|
||||||
|
= t('admin.reports.actions.force_cw_description_html')
|
||||||
.report-actions__item
|
.report-actions__item
|
||||||
.report-actions__item__button
|
.report-actions__item__button
|
||||||
= button_tag t('admin.reports.delete_and_resolve'), name: :delete, class: 'button button--destructive'
|
= button_tag t('admin.reports.delete_and_resolve'), name: :delete, class: 'button button--destructive'
|
||||||
|
|
|
@ -1835,6 +1835,7 @@ en:
|
||||||
explanation:
|
explanation:
|
||||||
delete_statuses: Some of your posts have been found to violate one or more community guidelines and have been subsequently removed by the moderators of %{instance}.
|
delete_statuses: Some of your posts have been found to violate one or more community guidelines and have been subsequently removed by the moderators of %{instance}.
|
||||||
disable: You can no longer use your account, but your profile and other data remains intact. You can request a backup of your data, change account settings or delete your account.
|
disable: You can no longer use your account, but your profile and other data remains intact. You can request a backup of your data, change account settings or delete your account.
|
||||||
|
force_cw: Some of your posts have been added warning (CW) by the moderators of %{instance}. This means that people will need to tap the text in the posts before a preview is displayed. You can add posts warning yourself when posting in the future.
|
||||||
mark_statuses_as_sensitive: Some of your posts have been marked as sensitive by the moderators of %{instance}. This means that people will need to tap the media in the posts before a preview is displayed. You can mark media as sensitive yourself when posting in the future.
|
mark_statuses_as_sensitive: Some of your posts have been marked as sensitive by the moderators of %{instance}. This means that people will need to tap the media in the posts before a preview is displayed. You can mark media as sensitive yourself when posting in the future.
|
||||||
sensitive: From now on, all your uploaded media files will be marked as sensitive and hidden behind a click-through warning.
|
sensitive: From now on, all your uploaded media files will be marked as sensitive and hidden behind a click-through warning.
|
||||||
silence: You can still use your account but only people who are already following you will see your posts on this server, and you may be excluded from various discovery features. However, others may still manually follow you.
|
silence: You can still use your account but only people who are already following you will see your posts on this server, and you may be excluded from various discovery features. However, others may still manually follow you.
|
||||||
|
@ -1844,6 +1845,7 @@ en:
|
||||||
subject:
|
subject:
|
||||||
delete_statuses: Your posts on %{acct} have been removed
|
delete_statuses: Your posts on %{acct} have been removed
|
||||||
disable: Your account %{acct} has been frozen
|
disable: Your account %{acct} has been frozen
|
||||||
|
force_cw: Your posts on %{acct} have been added warning
|
||||||
mark_statuses_as_sensitive: Your posts on %{acct} have been marked as sensitive
|
mark_statuses_as_sensitive: Your posts on %{acct} have been marked as sensitive
|
||||||
none: Warning for %{acct}
|
none: Warning for %{acct}
|
||||||
sensitive: Your posts on %{acct} will be marked as sensitive from now on
|
sensitive: Your posts on %{acct} will be marked as sensitive from now on
|
||||||
|
@ -1852,6 +1854,7 @@ en:
|
||||||
title:
|
title:
|
||||||
delete_statuses: Posts removed
|
delete_statuses: Posts removed
|
||||||
disable: Account frozen
|
disable: Account frozen
|
||||||
|
force_cw: Posts added warning
|
||||||
mark_statuses_as_sensitive: Posts marked as sensitive
|
mark_statuses_as_sensitive: Posts marked as sensitive
|
||||||
none: Warning
|
none: Warning
|
||||||
sensitive: Account marked as sensitive
|
sensitive: Account marked as sensitive
|
||||||
|
|
|
@ -1769,6 +1769,7 @@ ja:
|
||||||
explanation:
|
explanation:
|
||||||
delete_statuses: あなたの投稿のいくつかは、1つ以上のコミュニティガイドラインに違反していることが判明し、%{instance}のモデレータによって削除されました。
|
delete_statuses: あなたの投稿のいくつかは、1つ以上のコミュニティガイドラインに違反していることが判明し、%{instance}のモデレータによって削除されました。
|
||||||
disable: アカウントは使用できませんが、プロフィールやその他のデータはそのまま残ります。 データのバックアップをリクエストしたり、アカウント設定を変更したり、アカウントを削除したりできます。
|
disable: アカウントは使用できませんが、プロフィールやその他のデータはそのまま残ります。 データのバックアップをリクエストしたり、アカウント設定を変更したり、アカウントを削除したりできます。
|
||||||
|
force_cw: あなたのいくつかの投稿は、%{instance}のモデレータによって閲覧注意としてマークされています。これは、投稿本文が表示される前にユーザが投稿内のボタンをタップする必要があることを意味します。あなたは将来投稿する際に自分自身で文章に警告を記述することができます。
|
||||||
mark_statuses_as_sensitive: あなたのいくつかの投稿は、%{instance}のモデレータによって閲覧注意としてマークされています。これは、プレビューが表示される前にユーザが投稿内のメディアをタップする必要があることを意味します。あなたは将来投稿する際に自分自身でメディアを閲覧注意としてマークすることができます。
|
mark_statuses_as_sensitive: あなたのいくつかの投稿は、%{instance}のモデレータによって閲覧注意としてマークされています。これは、プレビューが表示される前にユーザが投稿内のメディアをタップする必要があることを意味します。あなたは将来投稿する際に自分自身でメディアを閲覧注意としてマークすることができます。
|
||||||
sensitive: 今後、アップロードされたすべてのメディアファイルは閲覧注意としてマークされ、クリック解除式の警告で覆われるようになります。
|
sensitive: 今後、アップロードされたすべてのメディアファイルは閲覧注意としてマークされ、クリック解除式の警告で覆われるようになります。
|
||||||
silence: アカウントが制限されています。このサーバーでは既にフォローしている人だけがあなたの投稿を見ることができます。 様々な発見機能から除外されるかもしれません。他の人があなたを手動でフォローすることは可能です。
|
silence: アカウントが制限されています。このサーバーでは既にフォローしている人だけがあなたの投稿を見ることができます。 様々な発見機能から除外されるかもしれません。他の人があなたを手動でフォローすることは可能です。
|
||||||
|
@ -1778,6 +1779,7 @@ ja:
|
||||||
subject:
|
subject:
|
||||||
delete_statuses: "%{acct}さんの投稿が削除されました"
|
delete_statuses: "%{acct}さんの投稿が削除されました"
|
||||||
disable: あなたのアカウント %{acct}は凍結されました
|
disable: あなたのアカウント %{acct}は凍結されました
|
||||||
|
force_cw: あなたの%{acct}の投稿はCWとして警告文が追加されました
|
||||||
mark_statuses_as_sensitive: あなたの%{acct}の投稿は閲覧注意としてマークされました
|
mark_statuses_as_sensitive: あなたの%{acct}の投稿は閲覧注意としてマークされました
|
||||||
none: "%{acct}に対する警告"
|
none: "%{acct}に対する警告"
|
||||||
sensitive: あなたの%{acct}の投稿はこれから閲覧注意としてマークされます
|
sensitive: あなたの%{acct}の投稿はこれから閲覧注意としてマークされます
|
||||||
|
@ -1786,6 +1788,7 @@ ja:
|
||||||
title:
|
title:
|
||||||
delete_statuses: 投稿が削除されました
|
delete_statuses: 投稿が削除されました
|
||||||
disable: アカウントが凍結されました
|
disable: アカウントが凍結されました
|
||||||
|
force_cw: 閲覧注意として警告が追加された投稿
|
||||||
mark_statuses_as_sensitive: 閲覧注意としてマークされた投稿
|
mark_statuses_as_sensitive: 閲覧注意としてマークされた投稿
|
||||||
none: 警告
|
none: 警告
|
||||||
sensitive: 閲覧注意としてマークされたアカウント
|
sensitive: 閲覧注意としてマークされたアカウント
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue