Sha256: e629ad0fbe58c1ed503674132e6a4495e93596fe09e5a6aea41ca312b535f858
Contents?: true
Size: 672 Bytes
Versions: 12
Compression:
Stored size: 672 Bytes
Contents
# frozen_string_literal: true module Decidim class EmailNotificationsDigestGeneratorJob < ApplicationJob queue_as :mailers def perform(user_id, frequency, time: Time.now.utc, force: false) user = Decidim::User.find_by(id: user_id) return if user.blank? should_notify = force || NotificationsDigestSendingDecider.must_notify?(user, time: time) return unless should_notify notification_ids = user.notifications.try(frequency, time: time).pluck(:id) return if notification_ids.blank? NotificationsDigestMailer.digest_mail(user, notification_ids).deliver_later user.update(digest_sent_at: time) end end end
Version data entries
12 entries across 12 versions & 1 rubygems