app/lib/actions/katello/repository/errata_mail.rb in katello-3.3.2 vs app/lib/actions/katello/repository/errata_mail.rb in katello-3.4.0.rc1
- old
+ new
@@ -15,10 +15,10 @@
repo = ::Katello::Repository.find(input[:repo])
users = ::User.select { |user| user.receives?(:sync_errata) && user.can?(:view_products, repo.product) }.compact
errata = ::Katello::Erratum.where(:id => repo.repository_errata.where('katello_repository_errata.updated_at > ?', input[:last_updated].to_datetime).pluck(:erratum_id))
begin
- MailNotification[:sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless users.blank?
+ MailNotification[:sync_errata].deliver_now(:users => users, :repo => repo, :errata => errata) unless (users.blank? || errata.blank?)
rescue => e
message = _('Unable to send errata e-mail notification: %{error}' % {:error => e})
Rails.logger.error(message)
output[:result] = message
end