Merge remote-tracking branch 'parent/main' into upstream-20240426
This commit is contained in:
commit
c4017eb993
22 changed files with 389 additions and 146 deletions
|
@ -52,9 +52,8 @@ class Admin::AccountAction
|
|||
process_reports!
|
||||
end
|
||||
|
||||
process_email!
|
||||
process_notification!
|
||||
process_queue!
|
||||
notify!
|
||||
end
|
||||
|
||||
def report
|
||||
|
@ -108,10 +107,6 @@ class Admin::AccountAction
|
|||
log_action(:create, @warning) if @warning.text.present? && type == 'none'
|
||||
end
|
||||
|
||||
def notify!
|
||||
LocalNotificationWorker.perform_async(target_account.id, @warning.id, 'AccountWarning', 'warning') if @warning && %w(none sensitive silence).include?(type)
|
||||
end
|
||||
|
||||
def process_reports!
|
||||
# If we're doing "mark as resolved" on a single report,
|
||||
# then we want to keep other reports open in case they
|
||||
|
@ -163,8 +158,11 @@ class Admin::AccountAction
|
|||
queue_suspension_worker! if type == 'suspend'
|
||||
end
|
||||
|
||||
def process_email!
|
||||
UserMailer.warning(target_account.user, warning).deliver_later! if warnable?
|
||||
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?
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue