diff --git a/lib/custom_wizard/action.rb b/lib/custom_wizard/action.rb index 2d539287..e45dab3a 100644 --- a/lib/custom_wizard/action.rb +++ b/lib/custom_wizard/action.rb @@ -143,6 +143,11 @@ class CustomWizard::Action notification_level = action['notification_level'] + if notification_level.blank? + log_error("Notifcation Level was not set! Exiting wizard action") + return + end + mute_remainder = CustomWizard::Mapper.new( inputs: action['mute_remainder'], data: data, @@ -150,7 +155,7 @@ class CustomWizard::Action ).perform Category.all.each do |category| - if watched_categories.include?(category.id.to_s) + if watched_categories.present? && watched_categories.include?(category.id.to_s) CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[notification_level.to_sym], category.id) elsif mute_remainder CategoryUser.set_notification_level_for_category(user, CategoryUser.notification_levels[:muted], category.id)