FIX: Email::Sender expects type to be a string (#27463)

In #26642 we introduced a change that re-attaches securely uploaded images in the digest e-mail. However, this change assumed that the type argument to the Email::Sender constructor would be a symbol, but when it is coming from the UserEmail job it is a string. This PR fixes that.
This commit is contained in:
Ted Johansson 2024-06-13 11:53:25 +08:00 committed by GitHub
parent 1f4aa343d8
commit a5df029be3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -253,7 +253,7 @@ module Email
if post.present? if post.present?
@stripped_secure_upload_shas = style.stripped_upload_sha_map.values @stripped_secure_upload_shas = style.stripped_upload_sha_map.values
add_attachments(post) add_attachments(post)
elsif @email_type == :digest elsif @email_type.to_s == "digest"
@stripped_secure_upload_shas = style.stripped_upload_sha_map.values @stripped_secure_upload_shas = style.stripped_upload_sha_map.values
digest_posts.each { |p| add_attachments(p) } digest_posts.each { |p| add_attachments(p) }
end end

View File

@ -659,7 +659,7 @@ RSpec.describe Email::Sender do
message.header["X-Discourse-Post-Id"] = nil message.header["X-Discourse-Post-Id"] = nil
message.header["X-Discourse-Post-Ids"] = "#{reply.id},#{other_post.id}" message.header["X-Discourse-Post-Ids"] = "#{reply.id},#{other_post.id}"
Email::Sender.new(message, :digest).send Email::Sender.new(message, "digest").send
expect(message.attachments.map(&:filename)).to include( expect(message.attachments.map(&:filename)).to include(
*[image, @secure_image, @secure_image_2].map(&:original_filename), *[image, @secure_image, @secure_image_2].map(&:original_filename),
) )