From 7c1df0adbd4071748f359289fbd0de5243b26733 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 f1b789270aaa..56b4d5ec0751 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_DIR.join('notification_types.yml')] + + Vmdb::Plugins.map { |plugin| plugin.root.join("content/notification_types.yml") } + .select(&:exist?) + .flat_map { |f| YAML.load_file(f) } end end