Revision 70aaaa22
Added by Tomer Brisker over 5 years ago
config/application.rb | ||
---|---|---|
config.after_initialize do
|
||
init_dynflow unless Foreman.in_rake?('db:create') || Foreman.in_rake?('db:drop')
|
||
setup_auditing
|
||
notify_deprecations unless Foreman.in_rake?
|
||
end
|
||
|
||
def dynflow
|
||
... | ... | |
def setup_auditing
|
||
Audit.send(:include, AuditSearch)
|
||
end
|
||
|
||
def notify_deprecations
|
||
blueprint = NotificationBlueprint.find_by_name('setting_deprecation')
|
||
[:locations_enabled, :organizations_enabled, :login].each do |setting|
|
||
next if SETTINGS[setting]
|
||
Foreman::Deprecation.deprecation_warning('1.21', "The #{setting} setting is deprecated")
|
||
message = UINotifications::StringParser.new(blueprint.message, {setting: setting, version: '1.21'}).to_s
|
||
next if blueprint.notifications.where(message: message).any?
|
||
Notification.create!(
|
||
audience: Notification::AUDIENCE_ADMIN,
|
||
message: message,
|
||
notification_blueprint: blueprint,
|
||
initiator: User.anonymous_admin,
|
||
:actions => {
|
||
:links => [
|
||
{
|
||
:href => 'https://community.theforeman.org/t/proposal-remove-support-for-disabling-taxonomies-or-login/10972',
|
||
:title => _('Further Information'),
|
||
:external => true
|
||
}
|
||
]
|
||
}
|
||
)
|
||
end
|
||
end
|
||
end
|
||
|
||
def self.setup_console
|
db/seeds.d/170-notification_blueprints.rb | ||
---|---|---|
}
|
||
},
|
||
{
|
||
group: _('Community'),
|
||
group: N_('Community'),
|
||
name: 'rss_post',
|
||
level: 'info',
|
||
message: _('RSS post message goes here'),
|
||
message: N_('RSS post message goes here'),
|
||
actions:
|
||
{
|
||
links:
|
||
[
|
||
title: _('URL'),
|
||
title: N_('URL'),
|
||
external: true
|
||
]
|
||
}
|
||
},
|
||
{
|
||
group: N_('Deprecations'),
|
||
name: 'setting_deprecation',
|
||
level: 'warning',
|
||
message: N_('The %{setting} setting has been deprecated and will be removed in version %{version}'),
|
||
expires_in: 30.days
|
||
}
|
||
]
|
||
|
Also available in: Unified diff
Fixes #24800 - Notify deprecation of taxonomy, login settings