aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm2
-rw-r--r--perllib/FixMyStreet/DB/RABXColumn.pm18
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm2
-rw-r--r--perllib/FixMyStreet/Email.pm3
-rw-r--r--perllib/FixMyStreet/Script/Alerts.pm1
-rw-r--r--perllib/FixMyStreet/TestAppProve.pm2
-rw-r--r--perllib/FixMyStreet/TestMech.pm2
10 files changed, 18 insertions, 20 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 36f736cd2..aa8d04988 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -21,7 +21,6 @@ use URI::QueryParam;
use Catalyst (
'Static::Simple',
- 'Unicode::Encoding',
'Session',
'Session::Store::DBIC',
'Session::State::Cookie', # FIXME - we're using our own override atm
@@ -46,8 +45,6 @@ __PACKAGE__->config(
name => 'FixMyStreet::App',
- encoding => 'UTF-8',
-
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index bd60f8570..495e47c2a 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -487,9 +487,6 @@ sub generate_csv : Private {
}
$csv->print($c->response, [
- map {
- $_ = encode('UTF-8', $_) if $_;
- }
@{$hashref}{
@{$c->stash->{csv}->{columns}}
},
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 49bdce379..b352b049e 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -563,7 +563,7 @@ sub load_and_group_problems : Private {
my $body = $c->stash->{body}; # Might be undef
my $filter = {
- order_by => $c->stash->{sort_order},
+ order_by => [ $c->stash->{sort_order}, { -desc => 'me.id' } ],
rows => $c->cobrand->reports_per_page,
};
if ($c->user_exists && $body) {
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 341fb6a30..986836b2f 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -430,7 +430,7 @@ sub munge_load_and_group_problems {
my $params = { map { my $n = $_; s/me\./problem\./; $_ => $where->{$n} } keys %$where };
my @c = $c->model('DB::Comment')->to_body($self->body)->search({
%$params,
- 'me.user_id' => { -not_in => [ $c->user->id, $self->body->comment_user_id ] },
+ 'me.user_id' => { -not_in => [ $c->user->id, $self->body->comment_user_id || () ] },
'me.state' => 'confirmed',
}, {
columns => 'problem_id',
diff --git a/perllib/FixMyStreet/DB/RABXColumn.pm b/perllib/FixMyStreet/DB/RABXColumn.pm
index d14b48dc8..76eb21030 100644
--- a/perllib/FixMyStreet/DB/RABXColumn.pm
+++ b/perllib/FixMyStreet/DB/RABXColumn.pm
@@ -52,6 +52,8 @@ set_filtered_column behaviour to not trust the cache.
sub rabx_column {
my ($class, $col) = @_;
+ my $data_type = $class->column_info($col)->{data_type};
+
# Apply the filtering for this column
$class->filter_column(
$col => {
@@ -59,6 +61,10 @@ sub rabx_column {
my $self = shift;
my $ser = shift;
return undef unless defined $ser;
+ # Some RABX columns are text, when they should be bytea. For
+ # these we must re-encode the string returned from the
+ # database, so that it is decoded again by RABX.
+ utf8::encode($ser) if $data_type ne 'bytea';
my $h = new IO::String($ser);
return RABX::wire_rd($h);
},
@@ -68,6 +74,10 @@ sub rabx_column {
my $ser = '';
my $h = new IO::String($ser);
RABX::wire_wr( $data, $h );
+ # Some RABX columns are text, when they should be bytea. For
+ # these, we must re-decode the string encoded by RABX, so that
+ # it is encoded again when saved to the db.
+ utf8::decode($ser) if $data_type ne 'bytea';
return $ser;
},
}
@@ -77,14 +87,6 @@ sub rabx_column {
$RABX_COLUMNS{ _get_class_identifier($class) }{$col} = 1;
}
-# The underlying column should always be UTF-8 encoded bytes.
-sub get_column {
- my ($self, $col) = @_;
- my $res = $self->next::method ($col);
- utf8::encode($res) if $RABX_COLUMNS{_get_class_identifier($self)}{$col} && utf8::is_utf8($res);
- return $res;
-}
-
sub set_filtered_column {
my ($self, $col, $val) = @_;
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 37fc34057..dae946816 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -273,7 +273,7 @@ sub categories_summary {
sub include_comment_counts {
my $rs = shift;
my $order_by = $rs->{attrs}{order_by};
- return $rs unless ref $order_by eq 'HASH' && $order_by->{-desc} eq 'comment_count';
+ return $rs unless ref $order_by eq 'ARRAY' && ref $order_by->[0] eq 'HASH' && $order_by->[0]->{-desc} eq 'comment_count';
$rs->search({}, {
'+select' => [ {
"" => \'(select count(*) from comment where problem_id=me.id and state=\'confirmed\')',
diff --git a/perllib/FixMyStreet/Email.pm b/perllib/FixMyStreet/Email.pm
index 2b72b5c63..49098b40d 100644
--- a/perllib/FixMyStreet/Email.pm
+++ b/perllib/FixMyStreet/Email.pm
@@ -357,8 +357,9 @@ sub construct_email ($) {
}
}
- if ($p->{_attachments_}) {
+ if (@{$p->{_attachments_}}) {
push @$parts, map { _mime_create(%$_) } @{$p->{_attachments_}};
+ $overall_type = 'multipart/mixed';
}
my $email = Email::MIME->create(
diff --git a/perllib/FixMyStreet/Script/Alerts.pm b/perllib/FixMyStreet/Script/Alerts.pm
index 55f4b3db5..3d2d784b8 100644
--- a/perllib/FixMyStreet/Script/Alerts.pm
+++ b/perllib/FixMyStreet/Script/Alerts.pm
@@ -333,7 +333,6 @@ sub _get_address_from_geocode {
my $geocode = shift;
return '' unless defined $geocode;
- utf8::encode($geocode) if utf8::is_utf8($geocode);
my $h = new IO::String($geocode);
my $data = RABX::wire_rd($h);
diff --git a/perllib/FixMyStreet/TestAppProve.pm b/perllib/FixMyStreet/TestAppProve.pm
index 0329bcfde..3786efaac 100644
--- a/perllib/FixMyStreet/TestAppProve.pm
+++ b/perllib/FixMyStreet/TestAppProve.pm
@@ -104,6 +104,8 @@ sub run {
my $config_out = $class->get_config({ config_file => $config_file, db_config_file => $db_config_file });
local $ENV{FMS_OVERRIDE_CONFIG} = $config_out;
+ # Don't warn over use of Regex dispatch type
+ local $ENV{CATALYST_NOWARN_DEPRECATE} = 1;
my $prove = App::Prove->new;
$prove->process_args(@ARGV);
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index 3ecb13b6a..848025e8a 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -718,7 +718,7 @@ sub encoded_content {
sub content_as_csv {
my $self = shift;
- open my $data_handle, '<', \$self->content;
+ open my $data_handle, '<:encoding(utf-8)', \$self->encoded_content;
my $csv = Text::CSV->new({ binary => 1 });
my @rows;
while (my $row = $csv->getline($data_handle)) {