aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Alert.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-06-03 20:21:13 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-06-03 20:21:13 +0100
commit5d2261eb81e9e28bbaa1f52c668be164bb7a597d (patch)
tree8144a0b47cff3fa3bc4a7dfd090d55162191174d /perllib/FixMyStreet/DB/Result/Alert.pm
parent5e3cc91d5c7cb3c48418cf26064de2ba214e6567 (diff)
Sign up new report to email alert if logged in as well as when confirmed by email. Allow disabling rather than deleting of alerts. Revert quoting as it breaks timestamps and literal SQL.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Alert.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Alert.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm
index b99c83a45..53cb96ff4 100644
--- a/perllib/FixMyStreet/DB/Result/Alert.pm
+++ b/perllib/FixMyStreet/DB/Result/Alert.pm
@@ -85,10 +85,18 @@ Sets the state of the alert to confirmed.
sub confirm {
my $self = shift;
- return if $self->confirmed and $self->confirmed == 1 and $self->whendisabled ne 'null';
-
$self->confirmed(1);
$self->whendisabled(undef);
+ $self->update;
+
+ return 1;
+}
+
+sub disable {
+ my $self = shift;
+
+ $self->whendisabled( \'ms_current_timestamp()' );
+ $self->update;
return 1;
}