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

Deliver notification mails immediately to run in same transaction

Oliver Günther3109d7bafa27
diff --git a/app/services/notifications/mail_service/comment_strategy.rb b/app/services/notifications/mail_service/comment_strategy.rb
index 735fd2d43a6..41dc42bfd4c 100644
--- a/app/services/notifications/mail_service/comment_strategy.rb
+++ b/app/services/notifications/mail_service/comment_strategy.rb
@@ -35,7 +35,7 @@ module Notifications::MailService::CommentStrategy
notification.resource,
notification.resource.author || DeletedUser.first
)
- .deliver_later
+ .deliver_now
end
end
end
diff --git a/app/services/notifications/mail_service/message_strategy.rb b/app/services/notifications/mail_service/message_strategy.rb
index 95bc15b0185..93381c3782b 100644
--- a/app/services/notifications/mail_service/message_strategy.rb
+++ b/app/services/notifications/mail_service/message_strategy.rb
@@ -35,7 +35,7 @@ module Notifications::MailService::MessageStrategy
notification.resource,
notification.actor || DeletedUser.first
)
- .deliver_later
+ .deliver_now
end
end
end
diff --git a/app/services/notifications/mail_service/news_strategy.rb b/app/services/notifications/mail_service/news_strategy.rb
index 454e88eb48b..0ca31ee7aff 100644
--- a/app/services/notifications/mail_service/news_strategy.rb
+++ b/app/services/notifications/mail_service/news_strategy.rb
@@ -37,7 +37,7 @@ module Notifications::MailService::NewsStrategy
notification.journal.journable,
notification.journal.user || DeletedUser.first
)
- .deliver_later
+ .deliver_now
end
end
end
diff --git a/app/services/notifications/mail_service/wiki_content_strategy.rb b/app/services/notifications/mail_service/wiki_content_strategy.rb
index 74cbd5381b1..005908d8343 100644
--- a/app/services/notifications/mail_service/wiki_content_strategy.rb
+++ b/app/services/notifications/mail_service/wiki_content_strategy.rb
@@ -36,7 +36,7 @@ module Notifications::MailService::WikiContentStrategy
notification.recipient,
notification.journal.journable,
notification.journal.user || DeletedUser.first)
- .deliver_later
+ .deliver_now
end
private
diff --git a/spec/services/notifications/mail_service_spec.rb b/spec/services/notifications/mail_service_spec.rb
index 795c18a7e92..a22d18c3100 100644
--- a/spec/services/notifications/mail_service_spec.rb
+++ b/spec/services/notifications/mail_service_spec.rb
@@ -71,7 +71,7 @@ describe Notifications::MailService, type: :model do
.and_return(mail)
allow(mail)
- .to receive(:deliver_later)
+ .to receive(:deliver_now)
mail
end
@@ -94,7 +94,7 @@ describe Notifications::MailService, type: :model do
journal.user)
expect(mail)
- .to have_received(:deliver_later)
+ .to have_received(:deliver_now)
end
end
@@ -111,7 +111,7 @@ describe Notifications::MailService, type: :model do
journal.user)
expect(mail)
- .to have_received(:deliver_later)
+ .to have_received(:deliver_now)
end
end
@@ -152,7 +152,7 @@ describe Notifications::MailService, type: :model do
.and_return(mail)
allow(mail)
- .to receive(:deliver_later)
+ .to receive(:deliver_now)
mail
end
@@ -175,7 +175,7 @@ describe Notifications::MailService, type: :model do
journal.user)
expect(mail)
- .to have_received(:deliver_later)
+ .to have_received(:deliver_now)
end
end
@@ -215,7 +215,7 @@ describe Notifications::MailService, type: :model do
.and_return(mail)
allow(mail)
- .to receive(:deliver_later)
+ .to receive(:deliver_now)
mail
end
@@ -234,7 +234,7 @@ describe Notifications::MailService, type: :model do
actor)
expect(mail)
- .to have_received(:deliver_later)
+ .to have_received(:deliver_now)
end
context 'with the notification read in app already' do