OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fixed suggestions from PR for health mailing
Andreas Pfohld5aa9c406886
diff --git a/config/environments/development.rb b/config/environments/development.rbindex 0bcb2c86e68..57626a9c851 100644--- a/config/environments/development.rb+++ b/config/environments/development.rb@@ -108,7 +108,6 @@ Rails.application.configure doconfig.action_controller.raise_on_missing_callback_actions = true# Send mails to browser window- config.action_mailer.delivery_method = :letter_openerconfig.action_mailer.delivery_method = File.exist?('/.dockerenv') ? :letter_opener_web : :letter_opener# Set email preview locations to rspecdiff --git a/modules/storages/app/workers/storages/health_status_mailer_job.rb b/modules/storages/app/workers/storages/health_status_mailer_job.rbindex e6decbc750f..ae715f5b2ed 100644--- a/modules/storages/app/workers/storages/health_status_mailer_job.rb+++ b/modules/storages/app/workers/storages/health_status_mailer_job.rb@@ -30,24 +30,33 @@module Storagesclass HealthStatusMailerJob < ApplicationJob- def perform(admins:, storage:)- if storage.health_healthy?- return- end+ def perform(storage:)+ return unless Storages::Storage.exists?(storage.id)++ storage.reload++ return if storage.health_healthy?- admins.each do |admin|- Storages::StoragesMailer.notify_unhealthy(admin, storage).deliver_now+ admin_users.each do |admin|+ Storages::StoragesMailer.notify_unhealthy(admin, storage).deliver_laterend- HealthStatusMailerJob.schedule(admins:, storage:)+ HealthStatusMailerJob.schedule(storage:)endclass << self- def schedule(admins:, storage:)+ def schedule(storage:)next_run_time = Date.tomorrow.beginning_of_day + 2.hours- HealthStatusMailerJob.set(wait_until: next_run_time).perform_later(admins: admins.records, storage:)+ HealthStatusMailerJob.set(wait_until: next_run_time).perform_later(storage:)endend++ private++ def admin_users+ User.where(admin: true)+ .where.not(mail: [nil, ''])+ endendend