alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
301 stars 236 forks source link

Prevent management pages using "plugin" GOV.UK Frontend views #2355

Closed colinrotherham closed 11 months ago

colinrotherham commented 11 months ago

This PR fixes https://github.com/alphagov/govuk-prototype-kit/issues/2352 for management pages only

The fix uses res.send() with a custom Nunjucks environment as used by getTemplatesViewHandler()

Management pages previously used Express.js res.render() with all plugin Nunjucks views available

GOV.UK Frontend v5 release

Without this bugfix, users upgrading to GOV.UK Frontend v5 would see management pages load Nunjucks views from GOV.UK Frontend v5 but fonts, assets, styles and scripts from GOV.UK Frontend v4

colinrotherham commented 11 months ago

Plenty of failing tests to look at

Nunjucks wise, management pages won’t have access to plugin filters, functions or Express.js app locals

colinrotherham commented 11 months ago

We're all set on this one now

I've made sure management pages keep Express.js app locals

colinrotherham commented 11 months ago

Thanks @BenSurgisonGDS, just added a CHANGELOG entry