From 249e6399c4276620095b427943171bf9bf9ec26f Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Fri, 16 Sep 2022 09:27:44 -0400 Subject: [PATCH] Add pluggable notification_types Allow plugins to bring their own notification_types in `content/notification_types.yml` --- app/models/notification_type.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/notification_type.rb b/app/models/notification_type.rb index f1b789270aa..3127b7df25a 100644 --- a/app/models/notification_type.rb +++ b/app/models/notification_type.rb @@ -54,7 +54,9 @@ def self.seed end def self.seed_data - fixture_file = File.join(FIXTURE_DIR, 'notification_types.yml') - File.exist?(fixture_file) ? YAML.load_file(fixture_file) : [] + fixture_files = Vmdb::Plugins.flat_map { |plugin| plugin.root.join("content/notification_types.yml") } + fixture_files << FIXTURE_DIR.join('notification_types.yml') + + fixture_files.select(&:exist?).flat_map { |f| YAML.load_file(f) } end end