aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/User.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-23 14:38:07 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-23 14:38:07 +0100
commit11c91b87abe2e89e8dc63a4d541fba7ed1d096b3 (patch)
tree5a315646cda9691ca63fd52f4cb3f9d3aafb1b4b /perllib/FixMyStreet/DB/Result/User.pm
parent41c7d068f954e062b4da0675b5782211b8ad10c3 (diff)
parent09ce7aeb489e5a43054c3b2b7bfa47fd6aba7c43 (diff)
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts: templates/web/default/report/display.html
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index cdac54280..dfcb18c5b 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -74,7 +74,7 @@ sub check_for_errors {
my %errors = ();
- if ( $self->name !~ m/\S/ ) {
+ if ( !$self->name || $self->name !~ m/\S/ ) {
$errors{name} = _('Please enter your name');
}
elsif (length( $self->name ) < 5
@@ -117,4 +117,20 @@ sub answered_ever_reported {
return $has_answered->count > 0;
}
+=head2 alert_for_problem
+
+Returns whether the user is already subscribed to an
+alert for the problem ID provided.
+
+=cut
+
+sub alert_for_problem {
+ my ( $self, $id ) = @_;
+
+ return $self->alerts->find( {
+ alert_type => 'new_updates',
+ parameter => $id,
+ } );
+}
+
1;