aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Comment.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-06-13 18:39:05 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-06-20 15:02:11 +0100
commite57cbf483790bedfef6496be3c7ffa42882c3ffc (patch)
treed01788502457f801a846cdac78213df5ecdf1ea5 /perllib/FixMyStreet/DB/Result/Comment.pm
parenta5f311e5147621f285cf31647ce675c502095882 (diff)
[UK] Remove requirement for fixed body IDs.
Historically in UK cobrands, bodies have had IDs the same as the MapIt area ID they cover. This can be confusing (if you are setting up a dev environment, say) and should not be necessary. This commit removes the requirement entirely, by switching any ID checks to either the name of the body, or the actual area it covers. One note: the body name in the test has to match so that we do not get two bodies both covering 2237 created. This will not be necessary when the tests are compartmentalized in the next commit.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Comment.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm12
1 files changed, 5 insertions, 7 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index d59245c15..1218d2f76 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -128,9 +128,10 @@ sub check_for_errors {
unless $self->text =~ m/\S/;
# Bromley Council custom character limit
- if ( $self->text && $self->problem && $self->problem->bodies_str
- && $self->problem->bodies_str eq '2482' && length($self->text) > 1750 ) {
- $errors{update} = sprintf( _('Updates are limited to %s characters in length. Please shorten your update'), 1750 );
+ if ( $self->text && $self->problem && $self->problem->bodies_str) {
+ if ($self->problem->to_body_named('Bromley') && length($self->text) > 1750) {
+ $errors{update} = sprintf( _('Updates are limited to %s characters in length. Please shorten your update'), 1750 );
+ }
}
return \%errors;
@@ -281,10 +282,7 @@ sub meta_line {
$update_state = _( 'marked as an internal referral' )
}
- if ($c->cobrand->moniker eq 'bromley' || (
- $self->problem->bodies_str &&
- $self->problem->bodies_str eq '2482'
- )) {
+ if ($c->cobrand->moniker eq 'bromley' || $self->problem->to_body_named('Bromley')) {
if ($state eq 'not responsible') {
$update_state = 'marked as third party responsibility'
}