Merge remote-tracking branch 'parent/main' into upstream-20240426

This commit is contained in:
KMY 2024-04-26 09:16:08 +09:00
commit c4017eb993
22 changed files with 389 additions and 146 deletions

View file

@ -17,7 +17,6 @@ class Admin::StatusBatchAction
def save!
process_action!
notify!
end
private
@ -68,7 +67,8 @@ class Admin::StatusBatchAction
statuses.each { |status| Tombstone.find_or_create_by(uri: status.uri, account: status.account, by_moderator: true) } unless target_account.local?
end
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
process_notification!
RemovalWorker.push_bulk(status_ids) { |status_id| [status_id, { 'preserve' => target_account.local?, 'immediate' => !target_account.local? }] }
end
@ -104,7 +104,7 @@ class Admin::StatusBatchAction
text: text
)
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
process_notification!
end
def handle_force_cw!
@ -140,7 +140,7 @@ class Admin::StatusBatchAction
text: text
)
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
process_notification!
end
def handle_report!
@ -158,10 +158,6 @@ class Admin::StatusBatchAction
report.save!
end
def notify!
LocalNotificationWorker.perform_async(target_account.id, @warning.id, 'AccountWarning', 'warning') if warnable? && @warning
end
def report
@report ||= Report.find(report_id) if report_id.present?
end
@ -170,6 +166,13 @@ class Admin::StatusBatchAction
!report.nil?
end
def process_notification!
return unless warnable?
UserMailer.warning(target_account.user, @warning).deliver_later!
LocalNotificationWorker.perform_async(target_account.id, @warning.id, 'AccountWarning', 'moderation_warning')
end
def warnable?
send_email_notification && target_account.local?
end