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

Merge read_email_digest into sent_mail for other email reasons

Oliver Günther180594593b2d
diff --git a/app/models/user.rb b/app/models/user.rb
index 297ad7b3fd3..c92d606e594 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -75,7 +75,6 @@ class User < Principal
scopes :find_by_login,
:newest,
- :notified_on_all,
:notified_globally,
:watcher_recipients,
:having_reminder_mail_to_send
diff --git a/app/workers/notifications/workflow_job.rb b/app/workers/notifications/workflow_job.rb
index 818236384b0..78db85ac638 100644
--- a/app/workers/notifications/workflow_job.rb
+++ b/app/workers/notifications/workflow_job.rb
@@ -63,6 +63,15 @@ class Notifications::WorkflowJob < ApplicationJob
wait: -> { Setting.journal_aggregation_time_minutes.to_i.minutes } do |*notification_ids|
next unless notification_ids
+ Notification
+ .where(id: notification_ids)
+ .where(reason: NotificationSetting.mail_reasons)
+ .each do |notification|
+ Notifications::MailService
+ .new(notification)
+ .call
+ end
+
Notification
.where(id: notification_ids)
.unread_mail # TODO
diff --git a/spec/factories/user_factory.rb b/spec/factories/user_factory.rb
index 659953fdbd8..2017eb7f734 100644
--- a/spec/factories/user_factory.rb
+++ b/spec/factories/user_factory.rb
@@ -58,7 +58,7 @@ FactoryBot.define do
user.pref.save if factory.preferences.present?
if user.notification_settings.empty?
- all_true = NotificationSetting.all_settings.index_with(true)
+ all_true = NotificationSetting.all_reasons.index_with(true)
user.notification_settings = [
FactoryBot.create(:notification_setting, user: user, **all_true),
]
diff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rb
index 039b19da28e..d4fca20734c 100644
--- a/spec/services/notifications/create_from_journal_job_shared.rb
+++ b/spec/services/notifications/create_from_journal_job_shared.rb
@@ -52,13 +52,13 @@ shared_context 'with CreateFromJournalJob context' do
end
let(:notification_settings_all_false) do
NotificationSetting
- .all_settings
+ .all_reasons
.index_with(false)
end
let(:notification_settings_all_true) do
NotificationSetting
- .all_settings
+ .all_reasons
.index_with(true)
end