Skip to content

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

Revert "fix[Op#52449]: Do not schedule daily notification job if unsubscribed"

Kabiru Mwenjac5d43b3ddf9d
diff --git a/modules/storages/app/services/storages/health_service.rb b/modules/storages/app/services/storages/health_service.rb
index b25d798937f..403b8ccbbdd 100644
--- a/modules/storages/app/services/storages/health_service.rb
+++ b/modules/storages/app/services/storages/health_service.rb
@@ -96,8 +96,6 @@ module Storages
end
def schedule_mail_job(storage)
- return unless storage.health_notifications_enabled?
-
::Storages::HealthStatusMailerJob.schedule(storage:)
end
diff --git a/modules/storages/spec/services/storages/health_service_spec.rb b/modules/storages/spec/services/storages/health_service_spec.rb
index 331d626d723..e1a0bdd35c3 100644
--- a/modules/storages/spec/services/storages/health_service_spec.rb
+++ b/modules/storages/spec/services/storages/health_service_spec.rb
@@ -131,43 +131,32 @@ RSpec.describe Storages::HealthService do
it "notifies admin users when the storage becomes healthy" do
expect do
health_service.healthy
- end.to(have_enqueued_mail(
- Storages::StoragesMailer, :notify_healthy
- ).with(admin_user, storage, storage.health_reason).at_most(:once)
- .and(have_enqueued_job(Storages::HealthStatusMailerJob).with(storage:).at_most(:once)))
+ end.to have_enqueued_mail(Storages::StoragesMailer, :notify_healthy)
+ .with(admin_user, storage, storage.health_reason).at_most(:once)
end
it "notifies admin users when the storage becomes unhealthy" do
expect do
health_service.unhealthy(reason: "thou_shall_not_pass_error")
- end.to(have_enqueued_mail(
- Storages::StoragesMailer, :notify_unhealthy
- ).with(admin_user, storage).at_most(:once)
- .and(have_enqueued_job(Storages::HealthStatusMailerJob).with(storage:).at_most(:once)))
+ end.to have_enqueued_mail(Storages::StoragesMailer, :notify_unhealthy).with(admin_user, storage).at_most(:once)
end
end
context "when the storage has notifications disabled" do
before do
storage.update(health_notifications_enabled: false)
-
- allow(Storages::HealthStatusMailerJob).to receive(:schedule).and_call_original
end
it "does not notify admin users when the storage becomes healthy" do
expect do
health_service.healthy
end.not_to have_enqueued_mail(Storages::StoragesMailer, :notify_healthy)
-
- expect(Storages::HealthStatusMailerJob).not_to have_received(:schedule)
end
it "does not notify admin users when the storage becomes unhealthy" do
expect do
health_service.unhealthy(reason: "thou_shall_not_pass_error")
end.not_to have_enqueued_mail(Storages::StoragesMailer, :notify_unhealthy)
-
- expect(Storages::HealthStatusMailerJob).not_to have_received(:schedule)
end
end
end