Skip to content

Commit

Permalink
Fix sending notice copy in submitter_widget_mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-hank committed Jun 7, 2024
1 parent f550e00 commit ced44aa
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/mailers/submitter_widget_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def send_submitted_notice_copy(notice)
end

mail(
to: notice.submitter.user.widget_submissions_forward_email,
to: notice.submitter.users.first.widget_submissions_forward_email,
subject: subject
)
end
Expand All @@ -27,7 +27,7 @@ def send_submitted_notice_copy(notice)
def notice_for_email(notice)
entities_fields = %w[name kind address_line_1 address_line_2 state country_code phone email url city zip]

notice.as_json(
json = notice.as_json(
only: %w[id title body created_at subject language jurisdictions tags type mark_registration_number],
include: {
submitters: {
Expand All @@ -44,16 +44,19 @@ def notice_for_email(notice)
},
attorneys: {
only: entities_fields
},
works: {
only: [:description],
include: {
infringing_urls: { only: %i[url] },
copyrighted_urls: { only: %i[url] }
}
}
}
)

json[:works] = notice.works.map do |work|
{
description: work.description,
infringing_urls: work.infringing_urls.map(&:url),
copyrighted_urls: work.copyrighted_urls.map(&:url)
}
end

json
end

def json_to_html(hash)
Expand Down

0 comments on commit ced44aa

Please sign in to comment.