Project

General

Profile

« Previous | Next » 

Revision 569b1708

Added by Amir Fefer over 8 years ago

Fixes #12508 - Test_email subscriptable field changed to false

In MailNtification at seeds.d, the test notification's subscriptable marked as true, though it a system notification.

View differences:

db/seeds.d/16-mail_notifications.rb
notifications = [
{
:name => :puppet_summary,
:name => 'puppet_summary',
:description => N_('A summary of eventful puppet reports'),
:mailer => 'HostMailer',
:method => 'summary',
......
},
{
:name => :puppet_error_state,
:name => 'puppet_error_state',
:description => N_('A notification when a host reports a puppet error'),
:mailer => 'HostMailer',
:method => 'error_state',
......
},
{
:name => :welcome,
:name => 'welcome',
:description => N_('A mail a user receives upon account creation'),
:mailer => 'UserMailer',
:method => 'welcome',
......
},
{
:name => :audit_summary,
:name => 'audit_summary',
:description => N_('A summary of audit changes report'),
:mailer => 'AuditMailer',
:method => 'summary',
......
:queryable => true
},
{:name => :host_built,
:description => N_('A notification when a host finishes building'),
:mailer => 'HostMailer',
:method => 'host_built',
:subscription_type => 'alert'
{
:name => 'host_built',
:description => N_('A notification when a host finishes building'),
:mailer => 'HostMailer',
:method => 'host_built',
:subscription_type => 'alert'
},
{
:name => :tester,
:name => 'tester',
:description => N_('A test message to check the email configuration is working'),
:mailer => 'UserMailer',
:method => 'tester',
:subscription_type => false
:subscriptable => false,
:subscription_type => nil
}
]
notifications.each do |notification|
MailNotification.create(notification) if MailNotification.where(:name => notification[:name]).blank?
if (mail = MailNotification.find_by_name(notification[:name]))
mail.attributes = notification
mail.save! if mail.changed?
else
created_notification = MailNotification.create(notification)
raise ::Foreman::Exception.new(N_("Unable to create mail notification: %s"),
format_errors(created_notification)) if created_notification.nil? || created_notification.errors.any?
end
end

Also available in: Unified diff