aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Template.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-11-27 20:15:33 +0000
committerMatthew Somerville <matthew@mysociety.org>2019-12-09 09:38:03 +0000
commit2e9e82dfb57b972d1351ecef86687a0d067598b1 (patch)
tree189119d0c2be5b0327855609d27cb745a3d14d7b /perllib/FixMyStreet/Template.pm
parent6c2d3d5a7d84521d34daa2cf7e4be76a54b3b0e0 (diff)
Switch to default-escaped in email templates.
We add a way to process a template with no auto-escaping, that can be used for the text parts of emails, and mark various HTML output as safe.
Diffstat (limited to 'perllib/FixMyStreet/Template.pm')
-rw-r--r--perllib/FixMyStreet/Template.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Template.pm b/perllib/FixMyStreet/Template.pm
index 354b6c911..84faeb562 100644
--- a/perllib/FixMyStreet/Template.pm
+++ b/perllib/FixMyStreet/Template.pm
@@ -40,10 +40,13 @@ sub Fn : ATTR(CODE,BEGIN) {
sub new {
my ($class, $config) = @_;
+ my $disable_autoescape = delete $config->{disable_autoescape};
$config->{FILTERS}->{$_} = $FILTERS{$_} foreach keys %FILTERS;
$config->{ENCODING} = 'utf8';
- $config->{STASH} = FixMyStreet::Template::Stash->new($config);
- $config->{CONTEXT} = FixMyStreet::Template::Context->new($config);
+ if (!$disable_autoescape) {
+ $config->{STASH} = FixMyStreet::Template::Stash->new($config);
+ $config->{CONTEXT} = FixMyStreet::Template::Context->new($config);
+ }
$class->SUPER::new($config);
}