diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 18 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm | 9 |
3 files changed, 38 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 58ce64af6..3078a4a2e 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -233,6 +233,24 @@ sub load_updates : Private { next if $questionnaires_with_updates{$q->id}; push @combined, [ $q->whenanswered, $q ]; } + + # And include moderation changes... + my $problem = $c->stash->{problem}; + my $public_history = $c->cobrand->call_hook(public_moderation_history => $problem); + my $user_can_moderate = $c->user_exists && $c->user->can_moderate($problem); + if ($public_history || $user_can_moderate) { + my @history = $problem->moderation_history; + my $last_history = $problem; + foreach my $history (@history) { + push @combined, [ $history->created, { + type => 'moderation', + last => $last_history, + entry => $history, + } ]; + $last_history = $history; + } + } + @combined = map { $_->[1] } sort { $a->[0] <=> $b->[0] } @combined; $c->stash->{updates} = \@combined; diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index 9c1e541d4..bc85bb090 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -17,6 +17,18 @@ sub report_validation { $errors->{detail} = sprintf( _('Reports are limited to %s characters in length. Please shorten your report'), 1700 ); } + if ( length( $report->name ) > 70 ) { + $errors->{name} = sprintf( 'Names are limited to %d characters in length.', 70 ); + } + + if ( length( $report->user->phone ) > 30 ) { + $errors->{phone} = sprintf( 'Phone numbers are limited to %s characters in length.', 30 ); + } + + if ( length( $report->user->email ) > 50 ) { + $errors->{username} = sprintf( 'Emails are limited to %s characters in length.', 50 ); + } + return $errors; } diff --git a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm index 01ae1d6e1..1e61b946a 100644 --- a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm +++ b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm @@ -167,7 +167,14 @@ sub compare_extra { push @s, string_diff("$_ = $old->{$_}", ""); } } - return join ', ', @s; + return join ', ', grep { $_ } @s; +} + +sub extra_diff { + my ($self, $other, $key) = @_; + my $o = $self->get_extra_metadata($key); + my $n = $other->get_extra_metadata($key); + return string_diff($o, $n); } sub string_diff { |