[Cases] Update notify user HTML email template to use current year dynamically (#161327)

## Summary

This PR adds current year dynamcially to notify user HTML email template
footer.


![image](0169d58b-d567-4061-bb7d-36326348aa99)

### Checklist

Delete any items that are not applicable to this PR.

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
This commit is contained in:
Janki Salvi 2023-07-06 14:11:52 +02:00 committed by GitHub
parent 1a5dc8253e
commit 4346b09760
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View file

@ -79,6 +79,7 @@ export const assigneesTemplateRenderer = async (
? `${caseData.attributes.description.slice(0, DESCRIPTION_LIMIT)}...`
: caseData.attributes.description,
url: caseUrl,
currentYear: new Date().getUTCFullYear(),
});
return template;

View file

@ -186,7 +186,7 @@
<tr>
<td
style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; line-height: 24px;">
© 2022 Elasticsearch B.V. All Rights Reserved.<br />
© {{currentYear}} Elasticsearch B.V. All Rights Reserved.<br />
Elasticsearch is a trademark of Elasticsearch BV, registered in the
U.S. and in other countries / <a href="https://www.elastic.co/legal/trademarks"
style="text-decoration: none; color: #0071C2; border-width: 0;">Trademarks</a>

View file

@ -73,4 +73,13 @@ describe('Assignees template', () => {
expect(container.querySelector('.btn')).not.toBeTruthy();
});
it('renders current year correctly', async () => {
const currentYear = new Date().getUTCFullYear();
const footerText = `© ${currentYear} Elasticsearch B.V. All Rights Reserved.`;
const container = await getHTMLNode(caseSO, mockCaseUrl);
expect(getByText(container, footerText, { exact: false })).toBeTruthy();
});
});