2
0

Add ability to email announcements to all users (#33928)

This commit is contained in:
Claire
2025-03-06 15:05:27 +01:00
committed by GitHub
parent d2ce9a6064
commit 5a100bf38f
20 changed files with 275 additions and 11 deletions

View File

@@ -0,0 +1,15 @@
# frozen_string_literal: true
class Admin::DistributeAnnouncementNotificationWorker
include Sidekiq::Worker
def perform(announcement_id)
announcement = Announcement.find(announcement_id)
announcement.scope_for_notification.find_each do |user|
UserMailer.announcement_published(user, announcement).deliver_later!
end
rescue ActiveRecord::RecordNotFound
true
end
end