aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm3
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm12
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm8
3 files changed, 12 insertions, 11 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index 00f88e136..958194eb8 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -107,6 +107,9 @@ sub check_for_errors {
my %errors = ();
+ $errors{name} = _('Please enter your name')
+ if !$self->name || $self->name !~ m/\S/;
+
$errors{update} = _('Please enter a message')
unless $self->text =~ m/\S/;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 1c8487ae7..d5d4b8102 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -274,7 +274,7 @@ sub check_for_errors {
unless $self->council
&& $self->council =~ m/^(?:-1|[\d,]+(?:\|[\d,]+)?)$/;
- if ( $self->name !~ m/\S/ ) {
+ if ( !$self->name || $self->name !~ m/\S/ ) {
$errors{name} = _('Please enter your name');
}
elsif (length( $self->name ) < 5
@@ -499,8 +499,7 @@ sub meta_line {
return $meta;
}
-# TODO Some/much of this could be moved to the template
-sub duration_string {
+sub body {
my ( $problem, $c ) = @_;
my $body;
if ($problem->external_body) {
@@ -522,6 +521,13 @@ sub duration_string {
} @councils
);
}
+ return $body;
+}
+
+# TODO Some/much of this could be moved to the template
+sub duration_string {
+ my ( $problem, $c ) = @_;
+ my $body = $problem->body( $c );
return sprintf(_('Sent to %s %s later'), $body,
Utils::prettify_duration($problem->whensent_local->epoch - $problem->confirmed_local->epoch, 'minute')
);
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 577d91c31..ada19a406 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -86,14 +86,6 @@ sub check_for_errors {
if ( !$self->name || $self->name !~ m/\S/ ) {
$errors{name} = _('Please enter your name');
}
- elsif (length( $self->name ) < 5
- || $self->name !~ m/\s/
- || $self->name =~ m/\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i )
- {
- $errors{name} = _(
-'Please enter your full name, councils need this information - if you do not wish your name to be shown on the site, untick the box'
- );
- }
if ( $self->email !~ /\S/ ) {
$errors{email} = _('Please enter your email');