Sha256: 1269b1e5da89d42e04e436311f8c9a4e87ffaad28c7018fb40b0dd416fd5def4

Contents?: true

Size: 730 Bytes

Versions: 12

Compression:

Stored size: 730 Bytes

Contents

# frozen_string_literal: true

namespace :decidim do
  namespace :mailers do
    desc "Task to send the notification digest email with the daily report"
    task notifications_digest_daily: :environment do
      notifications_digest(:daily)
    end

    desc "Task to send the notification digest email with the weekly report"
    task notifications_digest_weekly: :environment do
      notifications_digest(:weekly)
    end
  end

  def notifications_digest(frequency)
    target_users = Decidim::User.where(notifications_sending_frequency: frequency)
    time = Time.now.utc
    target_users.find_each do |user|
      Decidim::EmailNotificationsDigestGeneratorJob.perform_later(user.id, frequency, time: time)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.8 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.7 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.6 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.5 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.4 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.3 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.2 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.1 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.0 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.0.rc2 lib/tasks/decidim_mailers_tasks.rake
decidim-core-0.27.0.rc1 lib/tasks/decidim_mailers_tasks.rake