0
0
Fork 0

Add in-app notifications for moderation actions/warnings (#30065)

This commit is contained in:
Claire 2024-04-25 19:26:05 +02:00 committed by GitHub
parent 0ec061aa8f
commit 4ef0b48b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 188 additions and 21 deletions

View file

@ -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