aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Alert.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-02-21 12:31:17 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-02-21 12:31:17 +0000
commite2bf144a6aaa19779fc55a04081a3c269b9d0f81 (patch)
tree00318d801d35948938743608252fccd2d1b4e585 /perllib/FixMyStreet/DB/Result/Alert.pm
parenteb0c0d42f3596c5dc21e9bcdcc02a4008a541c34 (diff)
parentf8a8948ddb790e7e7593d538c55a3a278fbf3973 (diff)
Merge remote branch 'origin/zurich'
(locale ignored, will rerun .po extraction after to get all changes.) Conflicts: locale/FixMyStreet.po locale/cy_GB.UTF-8/LC_MESSAGES/EmptyHomes.po locale/de_CH.UTF-8/LC_MESSAGES/FixMyStreet.po locale/nb_NO.UTF-8/LC_MESSAGES/FixMyStreet.po locale/nn_NO.UTF-8/LC_MESSAGES/FixMyStreet.po templates/web/fixmystreet/report/banner.html templates/web/zurich/faq/faq-de-ch.html
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Alert.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Alert.pm31
1 files changed, 15 insertions, 16 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm
index ca9ad45c2..fc84c8fd5 100644
--- a/perllib/FixMyStreet/DB/Result/Alert.pm
+++ b/perllib/FixMyStreet/DB/Result/Alert.pm
@@ -77,22 +77,21 @@ with 'FixMyStreet::Roles::Abuser';
my $tz = DateTime::TimeZone->new( name => "local" );
-
-sub whensubscribed_local {
- my $self = shift;
-
- return $self->whensubscribed
- ? $self->whensubscribed->set_time_zone($tz)
- : $self->whensubscribed;
-}
-
-sub whendisabled_local {
- my $self = shift;
-
- return $self->whendisabled
- ? $self->whendisabled->set_time_zone($tz)
- : $self->whendisabled;
-}
+my $tz_f;
+$tz_f = DateTime::TimeZone->new( name => FixMyStreet->config('TIME_ZONE') )
+ if FixMyStreet->config('TIME_ZONE');
+
+my $stz = sub {
+ my ( $orig, $self ) = ( shift, shift );
+ my $s = $self->$orig(@_);
+ return $s unless $s && UNIVERSAL::isa($s, "DateTime");
+ $s->set_time_zone($tz);
+ $s->set_time_zone($tz_f) if $tz_f;
+ return $s;
+};
+
+around whensubscribed => $stz;
+around whendisabled => $stz;
=head2 confirm