Skip to content

Commit

Permalink
Use standard format_time with digest mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Aug 5, 2024
1 parent fbccec6 commit 873f9e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/helpers/mail_digest_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#++

module MailDigestHelper
include Redmine::I18n

def digest_summary_text(notification_count, mentioned_count)
mentioned = mentioned_count > 1 ? "plural" : "singular"
notifications = notification_count > 1 ? "plural" : "singular"
Expand Down Expand Up @@ -75,9 +77,7 @@ def timestamp_text(user, journal)
sanitize(
I18n.t(:"mail.work_packages.#{value}_at",
user:,
timestamp: journal.created_at.strftime(
"#{I18n.t(:"date.formats.default")}, #{I18n.t(:"time.formats.time")}"
))
timestamp: format_time(journal.created_at))
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/mailers/digest_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
end

it "includes the notifications grouped by work package" do
time_stamp = journal.created_at.strftime("%m/%d/%Y, %I:%M %p")
time_stamp = format_time(journal.created_at)
expect(mail_body)
.to have_text("Hello #{recipient.firstname}")

Expand Down
2 changes: 1 addition & 1 deletion spec/mailers/previews/digest_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DigestMailerPreview < ActionMailer::Preview
# Preview emails at http://localhost:3000/rails/mailers/digest_mailer

def work_packages
notifications = Notification.where(resource_type: "WorkPackage")
notifications = Notification.where(resource_type: "WorkPackage").limit(10)
DigestMailer.work_packages(notifications.first.recipient_id, [notifications.ids])
end
end

0 comments on commit 873f9e8

Please sign in to comment.