Skip to content

Commit ced44aa

Browse files
committed
Fix sending notice copy in submitter_widget_mailer
1 parent f550e00 commit ced44aa

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

app/mailers/submitter_widget_mailer.rb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def send_submitted_notice_copy(notice)
1717
end
1818

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

30-
notice.as_json(
30+
json = notice.as_json(
3131
only: %w[id title body created_at subject language jurisdictions tags type mark_registration_number],
3232
include: {
3333
submitters: {
@@ -44,16 +44,19 @@ def notice_for_email(notice)
4444
},
4545
attorneys: {
4646
only: entities_fields
47-
},
48-
works: {
49-
only: [:description],
50-
include: {
51-
infringing_urls: { only: %i[url] },
52-
copyrighted_urls: { only: %i[url] }
53-
}
5447
}
5548
}
5649
)
50+
51+
json[:works] = notice.works.map do |work|
52+
{
53+
description: work.description,
54+
infringing_urls: work.infringing_urls.map(&:url),
55+
copyrighted_urls: work.copyrighted_urls.map(&:url)
56+
}
57+
end
58+
59+
json
5760
end
5861

5962
def json_to_html(hash)

0 commit comments

Comments
 (0)