Skip to content

Commit

Permalink
Merge pull request #17021 from opf/bug/58555-reminder-mmail-not-sent-…
Browse files Browse the repository at this point in the history
…in-case-more-than-15-notifications-are-to-be-reported-about

Bug/58555 reminder mail not sent in case more than 15 notifications are to be reported about
  • Loading branch information
machisuji authored Oct 23, 2024
2 parents 654c2e3 + 8937def commit 5109cf5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/digest_mailer/work_packages.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<table <%= placeholder_table_styles %>>
<tr>
<td style="background: #D1E5F5; padding: 8px 12px; border: 1px solid #1A67A3; border-radius: 16px; overflow: hidden; text-overflow: ellipsis;">
<a href="<%= notifications_path %>"
<a href="<%= notifications_url %>"
target="_blank"
style="color: #1A67A3; text-decoration: none; font-size: 14px;white-space: nowrap;">
<%= I18n.t(:'mail.work_packages.see_all') %>
Expand Down
6 changes: 5 additions & 1 deletion app/workers/mails/reminder_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class Mails::ReminderJob < Mails::DeliverJob

good_job_control_concurrency_with(
total_limit: 1,
key: -> { "#{self.class.name}-#{arguments.last}" }
key: -> do
id = arguments.last.respond_to?(:id) ? arguments.last.id : arguments.last

"#{self.class.name}-#{id}"
end
)

private
Expand Down
10 changes: 10 additions & 0 deletions spec/mailers/digest_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@
.to have_text(expected_text, normalize_ws: true)
end

it "includes a reference to the notification center if there are more than the maximum number of shown work packages" do
stub_const("DigestMailer::MAX_SHOWN_WORK_PACKAGES", 0)

expect(mail_body)
.to have_text I18n.t(:"mail.work_packages.more_to_see.one")

expect(mail_body)
.to have_link(I18n.t(:"mail.work_packages.see_all"), href: notifications_url)
end

context "with only a deleted work package for the digest" do
let(:work_package) { nil }

Expand Down

0 comments on commit 5109cf5

Please sign in to comment.