Sha256: a4080bf2ea7f8275923b987eb4f744eb05aec4e2380aac3e1739a41df5b7af38

Contents?: true

Size: 957 Bytes

Versions: 123

Compression:

Stored size: 957 Bytes

Contents

module Katello
  class SubscriptionMailer < ApplicationMailer
    helper :'katello/subscription_mailer'
    after_action :prevent_sending_blank_report
    include SubscriptionMailerHelper

    def subscription_expiry(options)
      user = ::User.find(options[:user])
      days_from_now = options[:query]

      ::User.as(user.login) do
        @pools = Katello::Pool.readable.expiring_in_days(days_from_now)
        @affected_hosts = ::Host::Managed.with_pools_expiring_in_days(days_from_now)
      end

      if @affected_hosts.any?
        start_report_task(days_from_now)
        @report_url = report_url
        @report_link = report_link
      end

      set_locale_for(user) do
        mail(:to => user.mail, :subject => _("You have subscriptions expiring within %s days") % days_from_now)
      end
    end

    private

    def prevent_sending_blank_report
      if @pools.blank?
        mail.perform_deliveries = false
      end
    end
  end
end

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
katello-4.12.1 app/mailers/katello/subscription_mailer.rb
katello-4.12.0 app/mailers/katello/subscription_mailer.rb
katello-4.12.0.rc3 app/mailers/katello/subscription_mailer.rb
katello-4.12.0.rc2 app/mailers/katello/subscription_mailer.rb
katello-4.12.0.rc1 app/mailers/katello/subscription_mailer.rb
katello-4.11.1 app/mailers/katello/subscription_mailer.rb
katello-4.11.0 app/mailers/katello/subscription_mailer.rb
katello-4.11.0.rc2 app/mailers/katello/subscription_mailer.rb
katello-4.11.0.rc1 app/mailers/katello/subscription_mailer.rb
katello-4.10.0 app/mailers/katello/subscription_mailer.rb
katello-4.9.2 app/mailers/katello/subscription_mailer.rb
katello-4.10.0.rc2 app/mailers/katello/subscription_mailer.rb
katello-4.10.0.rc1 app/mailers/katello/subscription_mailer.rb
katello-4.8.4 app/mailers/katello/subscription_mailer.rb
katello-4.9.1 app/mailers/katello/subscription_mailer.rb
katello-4.8.3 app/mailers/katello/subscription_mailer.rb
katello-4.9.0 app/mailers/katello/subscription_mailer.rb
katello-4.7.6 app/mailers/katello/subscription_mailer.rb
katello-4.8.2 app/mailers/katello/subscription_mailer.rb
katello-4.9.0.rc2 app/mailers/katello/subscription_mailer.rb