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
Enabled letter_opener_web per default
Andreas Pfohl976a5eb0c2f4
diff --git a/config/environments/development.rb b/config/environments/development.rbindex 57626a9c851..4839e5f294d 100644--- a/config/environments/development.rb+++ b/config/environments/development.rb@@ -108,7 +108,7 @@ Rails.application.configure doconfig.action_controller.raise_on_missing_callback_actions = true# Send mails to browser window- config.action_mailer.delivery_method = File.exist?('/.dockerenv') ? :letter_opener_web : :letter_opener+ config.action_mailer.delivery_method = :letter_opener_web# Set email preview locations to rspecconfig.action_mailer.preview_paths << Rails.root.join('spec/mailers/previews')diff --git a/modules/storages/app/services/storages/health/health_service.rb b/modules/storages/app/services/storages/health_service.rbsimilarity index 54%rename from modules/storages/app/services/storages/health/health_service.rbrename to modules/storages/app/services/storages/health_service.rbindex 5c801bf9fe9..f8e8d84f7b4 100644--- a/modules/storages/app/services/storages/health/health_service.rb+++ b/modules/storages/app/services/storages/health_service.rb@@ -27,50 +27,48 @@#++module Storages- module Health- class HealthService- def initialize(storage:)- @storage = storage- end+ class HealthService+ def initialize(storage:)+ @storage = storage+ end- def healthy- was_unhealthy = @storage.health_unhealthy?- reason = @storage.health_reason+ def healthy+ was_unhealthy = @storage.health_unhealthy?+ reason = @storage.health_reason- @storage.mark_as_healthy+ @storage.mark_as_healthy- admin_users.each do |admin|- ::Storages::StoragesMailer.notify_healthy(admin, @storage, reason).deliver_later if was_unhealthy- end+ admin_users.each do |admin|+ ::Storages::StoragesMailer.notify_healthy(admin, @storage, reason).deliver_later if was_unhealthyend+ end- def unhealthy(reason:)- last_reason = @storage.health_reason- @storage.mark_as_unhealthy(reason:)+ def unhealthy(reason:)+ last_reason = @storage.health_reason+ @storage.mark_as_unhealthy(reason:)- if @storage.health_reason != last_reason- admin_users.each do |admin|- ::Storages::StoragesMailer.notify_unhealthy(admin, @storage).deliver_later- end+ if @storage.health_reason != last_reason+ admin_users.each do |admin|+ ::Storages::StoragesMailer.notify_unhealthy(admin, @storage).deliver_laterend-- schedule_mail_job(@storage) unless mail_job_exists?end- private+ schedule_mail_job(@storage) unless mail_job_exists?+ end- def admin_users- User.where(admin: true)- .where.not(mail: [nil, ''])- end+ private- def schedule_mail_job(storage)- ::Storages::HealthStatusMailerJob.schedule(admins: admin_users, storage:)- end+ def admin_users+ User.where(admin: true)+ .where.not(mail: [nil, ''])+ end- def mail_job_exists?- Delayed::Job.where('handler LIKE ?', "%job_class: Storages::HealthStatusMailerJob%").any?- end+ def schedule_mail_job(storage)+ ::Storages::HealthStatusMailerJob.schedule(admins: admin_users, storage:)+ end++ def mail_job_exists?+ Delayed::Job.where('handler LIKE ?', "%job_class: Storages::HealthStatusMailerJob%").any?endendenddiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex 26a8011caad..a479f41dd2a 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -106,13 +106,13 @@ module OpenProject::StoragesOpenProject::Notifications.subscribe(::OpenProject::Events::STORAGE_TURNED_UNHEALTHY) do |payload|- Storages::Health::HealthService.new(storage: payload[:storage]).unhealthy(reason: payload[:reason])+ Storages::HealthService.new(storage: payload[:storage]).unhealthy(reason: payload[:reason])endOpenProject::Notifications.subscribe(::OpenProject::Events::STORAGE_TURNED_HEALTHY) do |payload|- Storages::Health::HealthService.new(storage: payload[:storage]).healthy+ Storages::HealthService.new(storage: payload[:storage]).healthyendendend