Skip to content

Commit

Permalink
Update Bulk Email greeting
Browse files Browse the repository at this point in the history
  • Loading branch information
diebas committed Oct 16, 2024
1 parent c7ac7f5 commit b2d8bef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def subject
"#{content_generator.subject_prefix} #{custom_subject}"
end

def body(recipient_name = nil)
content_generator.wrap_text(custom_message, recipient_name)
def body
content_generator.wrap_text(custom_message)
end

def reply_to
Expand All @@ -56,7 +56,7 @@ def reply_to

def deliver(recipient)
Mailer
.send_mail(recipient: recipient, subject: subject, body: body(recipient.full_name), reply_to: reply_to, facility: SerializableFacility.new(facility))
.send_mail(recipient: recipient, subject: subject, body: body, reply_to: reply_to, facility: SerializableFacility.new(facility))
.deliver_later
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class ContentGenerator

include TextHelpers::Translation

DEFAULT_RECIPIENT_NAME = "Firstname Lastname"

attr_reader :facility, :subject_product

def initialize(facility, subject_product = nil)
Expand All @@ -23,13 +21,13 @@ def subject_prefix
end
end

def wrap_text(text, recipient_name = nil)
[greeting(recipient_name), text].compact.join("\n\n")
def wrap_text(text)
[greeting, text].compact.join("\n\n")
end

def greeting(recipient_name = nil)
def greeting
[
text("body.greeting", recipient_name: recipient_name || DEFAULT_RECIPIENT_NAME),
text("body.greeting"),
reason_statement,
].compact.join("\n\n")
end
Expand Down
2 changes: 1 addition & 1 deletion vendor/engines/bulk_email/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ en:
subject_prefix: "[!app_name!]"
subject_prefix_with_facility: "[!app_name! %{abbreviation}]"
body:
greeting: Hello %{recipient_name},
greeting: Hello,
delivery:
success:
one: "%{count} email message queued successfully."
Expand Down

0 comments on commit b2d8bef

Please sign in to comment.