Add in-app notifications for moderation actions/warnings (#30065)
This commit is contained in:
@@ -65,7 +65,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
|
||||
|
||||
@@ -101,7 +102,7 @@ class Admin::StatusBatchAction
|
||||
text: text
|
||||
)
|
||||
|
||||
UserMailer.warning(target_account.user, @warning).deliver_later! if warnable?
|
||||
process_notification!
|
||||
end
|
||||
|
||||
def handle_report!
|
||||
@@ -127,6 +128,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
|
||||
|
||||
Reference in New Issue
Block a user