aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdb/rerun_dbic_loader.pl2
-rw-r--r--perllib/DBIx/Class/EncodedColumn.pm262
-rw-r--r--perllib/DBIx/Class/FixMyStreet/EncodedColumn.pm48
-rw-r--r--perllib/DBIx/Class/FixMyStreet/InflateColumn/DateTime.pm36
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/ReportExtraFields.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/DB/Result/Abuse.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/AdminLog.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Alert.pm21
-rw-r--r--perllib/FixMyStreet/DB/Result/AlertSent.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/AlertType.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Body.pm28
-rw-r--r--perllib/FixMyStreet/DB/Result/BodyArea.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Comment.pm21
-rw-r--r--perllib/FixMyStreet/DB/Result/Contact.pm14
-rw-r--r--perllib/FixMyStreet/DB/Result/ContactDefectType.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/ContactResponsePriority.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/ContactResponseTemplate.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/ContactsHistory.pm14
-rw-r--r--perllib/FixMyStreet/DB/Result/DefectType.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm105
-rw-r--r--perllib/FixMyStreet/DB/Result/Questionnaire.pm21
-rw-r--r--perllib/FixMyStreet/DB/Result/ReportExtraField.pm (renamed from perllib/FixMyStreet/DB/Result/ReportExtraFields.pm)12
-rw-r--r--perllib/FixMyStreet/DB/Result/ResponsePriority.pm14
-rw-r--r--perllib/FixMyStreet/DB/Result/ResponseTemplate.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Secret.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Session.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/State.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Token.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/Translation.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm14
-rw-r--r--perllib/FixMyStreet/DB/Result/UserBodyPermission.pm10
-rw-r--r--perllib/FixMyStreet/DB/Result/UserPlannedReport.pm10
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/ReportExtraField.pm (renamed from perllib/FixMyStreet/DB/ResultSet/ReportExtraFields.pm)2
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm10
-rw-r--r--perllib/Open311/GetServiceRequests.pm8
-rw-r--r--t/app/controller/admin/reportextrafields.t10
-rw-r--r--t/app/controller/alert_new.t252
-rw-r--r--t/app/controller/contact.t2
-rw-r--r--t/app/controller/report_inspect.t2
-rw-r--r--t/open311/getservicerequests.t9
-rw-r--r--t/open311/getservicerequestupdates.t6
44 files changed, 405 insertions, 698 deletions
diff --git a/db/rerun_dbic_loader.pl b/db/rerun_dbic_loader.pl
index cf6e89ab2..1eff12d9e 100755
--- a/db/rerun_dbic_loader.pl
+++ b/db/rerun_dbic_loader.pl
@@ -38,7 +38,7 @@ make_schema_at(
resultset_namespace => '+FixMyStreet::DB::ResultSet',
# add in some extra components
- components => [ 'FilterColumn', 'InflateColumn::DateTime', 'EncodedColumn' ],
+ components => [ 'FilterColumn', 'FixMyStreet::InflateColumn::DateTime', 'FixMyStreet::EncodedColumn' ],
},
[ FixMyStreet->dbic_connect_info ],
diff --git a/perllib/DBIx/Class/EncodedColumn.pm b/perllib/DBIx/Class/EncodedColumn.pm
deleted file mode 100644
index b4a08b35c..000000000
--- a/perllib/DBIx/Class/EncodedColumn.pm
+++ /dev/null
@@ -1,262 +0,0 @@
-package DBIx::Class::EncodedColumn;
-
-use strict;
-use warnings;
-
-use base qw/DBIx::Class/;
-use Sub::Name;
-
-__PACKAGE__->mk_classdata( '_column_encoders' );
-
-our $VERSION = '0.00011';
-$VERSION = eval $VERSION;
-
-sub register_column {
- my $self = shift;
- my ($column, $info) = @_;
- $self->next::method(@_);
-
- return unless exists $info->{encode_column} && $info->{encode_column} == 1;
- $self->throw_exception("'encode_class' is a required argument.")
- unless exists $info->{encode_class} && defined $info->{encode_class};
- my $class = $info->{encode_class};
-
- my $args = exists $info->{encode_args} ? $info->{encode_args} : {};
- $self->throw_exception("'encode_args' must be a hashref")
- unless ref $args eq 'HASH';
-
- $class = join("::", 'DBIx::Class::EncodedColumn', $class);
- eval "require ${class};";
- $self->throw_exception("Failed to use encode_class '${class}': $@") if $@;
-
- defined( my $encode_sub = eval{ $class->make_encode_sub($column, $args) }) ||
- $self->throw_exception("Failed to create encoder with class '$class': $@");
- $self->_column_encoders({$column => $encode_sub, %{$self->_column_encoders || {}}});
-
- if ( exists $info->{encode_check_method} && $info->{encode_check_method} ){
- no strict 'refs';
- defined( my $check_sub = eval{ $class->make_check_sub($column, $args) }) ||
- $self->throw_exception("Failed to create checker with class '$class': $@");
- my $name = join '::', $self->result_class, $info->{encode_check_method};
- *$name = subname $name, $check_sub;
- }
-}
-
-# mySociety override to allow direct setting without double encryption
-sub set_column {
- my $self = shift;
- return $self->next::method(@_) unless defined $_[1] and not defined $_[2];
- my $encs = $self->_column_encoders;
- if(exists $encs->{$_[0]} && defined(my $encoder = $encs->{$_[0]})){
- return $self->next::method($_[0], $encoder->($_[1]));
- }
- $self->next::method(@_);
-}
-
-sub new {
- my($self, $attr, @rest) = @_;
- my $encoders = $self->_column_encoders;
- for my $col (grep { defined $encoders->{$_} } keys %$encoders ) {
- next unless exists $attr->{$col} && defined $attr->{$col};
- $attr->{$col} = $encoders->{$col}->( $attr->{$col} );
- }
- return $self->next::method($attr, @rest);
-}
-
-1;
-
-__END__;
-
-=head1 NAME
-
-DBIx::Class::EncodedColumn - Automatically encode columns
-
-=head1 SYNOPSIS
-
-In your L<DBIx::Class> Result class
-(sometimes erroneously referred to as the 'table' class):
-
- __PACKAGE__->load_components(qw/EncodedColumn ... Core/);
-
- #Digest encoder with hex format and SHA-1 algorithm
- __PACKAGE__->add_columns(
- 'password' => {
- data_type => 'CHAR',
- size => 40,
- encode_column => 1,
- encode_class => 'Digest',
- encode_args => {algorithm => 'SHA-1', format => 'hex'},
- }
-
- #SHA-1 / hex encoding / generate check method
- __PACKAGE__->add_columns(
- 'password' => {
- data_type => 'CHAR',
- size => 40 + 10,
- encode_column => 1,
- encode_class => 'Digest',
- encode_args => {algorithm => 'SHA-1', format => 'hex', salt_length => 10},
- encode_check_method => 'check_password',
- }
-
- #MD5 / base64 encoding / generate check method
- __PACKAGE__->add_columns(
- 'password' => {
- data_type => 'CHAR',
- size => 22,
- encode_column => 1,
- encode_class => 'Digest',
- encode_args => {algorithm => 'MD5', format => 'base64'},
- encode_check_method => 'check_password',
- }
-
- #Eksblowfish bcrypt / cost of 8/ no key_nul / generate check method
- __PACKAGE__->add_columns(
- 'password' => {
- data_type => 'CHAR',
- size => 59,
- encode_column => 1,
- encode_class => 'Crypt::Eksblowfish::Bcrypt',
- encode_args => { key_nul => 0, cost => 8 },
- encode_check_method => 'check_password',
- }
-
-In your application code:
-
- #updating the value.
- $row->password('plaintext');
- my $digest = $row->password;
-
- #checking against an existing value with a check_method
- $row->check_password('old_password'); #true
- $row->password('new_password');
- $row->check_password('new_password'); #returns true
- $row->check_password('old_password'); #returns false
-
-
-B<Note:> The component needs to be loaded I<before> Core.
-
-=head1 DESCRIPTION
-
-This L<DBIx::Class> component can be used to automatically encode a column's
-contents whenever the value of that column is set.
-
-This module is similar to the existing L<DBIx::Class::DigestColumns>, but there
-is some key differences:
-
-=over 4
-
-=item C<DigestColumns> performs the encode operation on C<insert> and C<update>,
-and C<EncodedColumn> performs the operation when the value is set, or on C<new>.
-
-=item C<DigestColumns> supports only algorithms of the L<Digest> family.
-C<EncodedColumn> employs a set of thin wrappers around different cipher modules
-to provide support for any cipher you wish to use and wrappers are very simple
-to write (typically less than 30 lines).
-
-=item C<EncodedColumn> supports having more than one encoded column per table
-and each column can use a different cipher.
-
-=item C<Encode> adds only one item to the namespace of the object utilizing
-it (C<_column_encoders>).
-
-=back
-
-There is, unfortunately, some features that C<EncodedColumn> doesn't support.
-C<DigestColumns> supports changing certain options at runtime, as well as
-the option to not automatically encode values on set. The author of this module
-found these options to be non-essential and omitted them by design.
-
-=head1 Options added to add_column
-
-If any one of these options is present the column will be treated as a digest
-column and all of the defaults will be applied to the rest of the options.
-
-=head2 encode_enable => 1
-
-Enable automatic encoding of column values. If this option is not set to true
-any other options will become no-ops.
-
-=head2 encode_check_method => $method_name
-
-By using the encode_check_method attribute when you declare a column you
-can create a check method for that column. The check method accepts a plain
-text string, and returns a boolean that indicates whether the digest of the
-provided value matches the current value.
-
-=head2 encode_class
-
-The class to use for encoding. Available classes are:
-
-=over 4
-
-=item C<Crypt::Eksblowfish::Bcrypt> - uses
-L<DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt> and
-requires L<Crypt::Eksblowfish::Bcrypt> to be installed
-
-=item C<Digest> - uses L<DBIx::Class::EncodedColumn::Digest>
-requires L<Digest> to be installed as well as the algorithm required
-(L<Digest::SHA>, L<Digest::Whirlpool>, etc)
-
-=item C<Crypt::OpenPGP> - L<DBIx::Class::EncodedColumn::Crypt::OpenPGP>
-and requires L<Crypt::OpenPGP> to be installed
-
-=back
-
-Please see the relevant class's documentation for information about the
-specific arguments accepted by each and make sure you include the encoding
-algorithm (e.g. L<Crypt::OpenPGP>) in your application's requirements.
-
-=head1 EXTENDED METHODS
-
-The following L<DBIx::Class::ResultSource> method is extended:
-
-=over 4
-
-=item B<register_column> - Handle the options described above.
-
-=back
-
-The following L<DBIx::Class::Row> methods are extended by this module:
-
-=over 4
-
-=item B<new> - Encode the columns on new() so that copy and create DWIM.
-
-=item B<set_column> - Encode values whenever column is set.
-
-=back
-
-=head1 SEE ALSO
-
-L<DBIx::Class::DigestColumns>, L<DBIx::Class>, L<Digest>
-
-=head1 AUTHOR
-
-Guillermo Roditi (groditi) <groditi@cpan.org>
-
-Inspired by the original module written by Tom Kirkpatrick (tkp) <tkp@cpan.org>
-featuring contributions from Guillermo Roditi (groditi) <groditi@cpan.org>
-and Marc Mims <marc@questright.com>
-
-=head1 CONTRIBUTORS
-
-jshirley - J. Shirley <cpan@coldhardcode.com>
-
-kentnl - Kent Fredric <kentnl@cpan.org>
-
-mst - Matt S Trout <mst@shadowcat.co.uk>
-
-wreis - Wallace reis <wreis@cpan.org>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2008 - 2009 the DBIx::Class::EncodedColumn L</AUTHOR> and
-L</CONTRIBUTORS> as listed above.
-
-=head1 LICENSE
-
-This library is free software and may be distributed under the same terms
-as perl itself.
-
-=cut
diff --git a/perllib/DBIx/Class/FixMyStreet/EncodedColumn.pm b/perllib/DBIx/Class/FixMyStreet/EncodedColumn.pm
new file mode 100644
index 000000000..0d86c7639
--- /dev/null
+++ b/perllib/DBIx/Class/FixMyStreet/EncodedColumn.pm
@@ -0,0 +1,48 @@
+package DBIx::Class::FixMyStreet::EncodedColumn;
+
+use strict;
+use warnings;
+
+use base qw/DBIx::Class::EncodedColumn/;
+
+# mySociety override to allow direct setting without double encryption
+sub set_column {
+ my $self = shift;
+ return DBIx::Class::Row::set_column($self, @_) unless defined $_[1] and not defined $_[2];
+ $self->next::method(@_);
+}
+
+1;
+
+__END__;
+
+=head1 NAME
+
+DBIx::Class::FixMyStreet::EncodedColumn - Automatically encode columns
+
+=head1 SYNOPSIS
+
+The same as DBIx::Class::EncodedColumn, but adding an extra optional second
+argument to set_column to allow skipping encryption (so if we hold an
+already-hashed password, we can set it directly).
+
+In your application code:
+
+ $row->password('plaintext');
+ $row->password('hashed-password', 1);
+
+=head1 EXTENDED METHODS
+
+The following L<DBIx::Class::Row> methods are extended by this module:
+
+=over 4
+
+=item B<set_column> - Encode values whenever column is set.
+
+=back
+
+=head1 SEE ALSO
+
+L<DBIx::Class::EncodedColumn>, L<DBIx::Class>
+
+=cut
diff --git a/perllib/DBIx/Class/FixMyStreet/InflateColumn/DateTime.pm b/perllib/DBIx/Class/FixMyStreet/InflateColumn/DateTime.pm
new file mode 100644
index 000000000..f2089d5a3
--- /dev/null
+++ b/perllib/DBIx/Class/FixMyStreet/InflateColumn/DateTime.pm
@@ -0,0 +1,36 @@
+package DBIx::Class::FixMyStreet::InflateColumn::DateTime;
+
+use strict;
+use warnings;
+use base qw/DBIx::Class::InflateColumn::DateTime/;
+use FixMyStreet;
+use namespace::clean;
+
+sub _post_inflate_datetime {
+ my $self = shift;
+ my $dt = $self->next::method(@_);
+ FixMyStreet->set_time_zone($dt);
+ return $dt;
+}
+
+sub _pre_deflate_datetime {
+ my $self = shift;
+ my $dt = $self->next::method(@_);
+ $dt->set_time_zone(FixMyStreet->local_time_zone);
+ return $dt;
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+DBIx::Class::FixMyStreet::InflateColumn::DateTime
+
+=head1 DESCRIPTION
+
+This acts the same as DBIx::Class::InflateColumn::DateTime, as if a
+'local' timezone object was attached to every datetime column, plus
+alters the timezone upon inflation to the configured timezone if it
+has been set, and uses a singleton to prevent needless disc access.
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ReportExtraFields.pm b/perllib/FixMyStreet/App/Controller/Admin/ReportExtraFields.pm
index 337fb4bed..0ddbb01f7 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/ReportExtraFields.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/ReportExtraFields.pm
@@ -9,7 +9,7 @@ BEGIN { extends 'Catalyst::Controller'; }
sub index : Path : Args(0) {
my ( $self, $c ) = @_;
- my @extras = $c->model('DB::ReportExtraFields')->search(
+ my @extras = $c->model('DB::ReportExtraField')->search(
undef,
{
order_by => 'name'
@@ -24,9 +24,9 @@ sub edit : Path : Args(1) {
my $extra;
if ( $extra_id eq 'new' ) {
- $extra = $c->model('DB::ReportExtraFields')->new({});
+ $extra = $c->model('DB::ReportExtraField')->new({});
} else {
- $extra = $c->model('DB::ReportExtraFields')->find( $extra_id )
+ $extra = $c->model('DB::ReportExtraField')->find( $extra_id )
or $c->detach( '/page_error_404_not_found' );
}
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index e032caa09..7f798f4f4 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -534,7 +534,7 @@ sub inspect : Private {
# to have the FMS timezone so we need to add the timezone otherwise
# dates come back out the database at time +/- timezone offset.
$timestamp = DateTime->from_epoch(
- time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone,
+ time_zone => FixMyStreet->local_time_zone,
epoch => $saved_at
);
}
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index 83d0f8572..8944a9307 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -757,7 +757,7 @@ sub setup_report_extra_fields : Private {
return unless $c->cobrand->allow_report_extra_fields;
- my @extras = $c->model('DB::ReportExtraFields')->for_cobrand($c->cobrand)->for_language($c->stash->{lang_code})->all;
+ my @extras = $c->model('DB::ReportExtraField')->for_cobrand($c->cobrand)->for_language($c->stash->{lang_code})->all;
$c->stash->{report_extra_fields} = \@extras;
}
diff --git a/perllib/FixMyStreet/DB/Result/Abuse.pm b/perllib/FixMyStreet/DB/Result/Abuse.pm
index e8e554afa..7818eb743 100644
--- a/perllib/FixMyStreet/DB/Result/Abuse.pm
+++ b/perllib/FixMyStreet/DB/Result/Abuse.pm
@@ -8,14 +8,18 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("abuse");
__PACKAGE__->add_columns("email", { data_type => "text", is_nullable => 0 });
__PACKAGE__->set_primary_key("email");
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PnQhGMx+ktK++3gWOMJBpQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:6XdWpymMMUEC4WT9Yh0RLw
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;
diff --git a/perllib/FixMyStreet/DB/Result/AdminLog.pm b/perllib/FixMyStreet/DB/Result/AdminLog.pm
index 1c9bd3a63..221690405 100644
--- a/perllib/FixMyStreet/DB/Result/AdminLog.pm
+++ b/perllib/FixMyStreet/DB/Result/AdminLog.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("admin_log");
__PACKAGE__->add_columns(
"id",
@@ -54,7 +58,7 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-07-20 14:38:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:y2xZ4BDv7H+f4vbIZyNflw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BLPP1KitphuY56ptaXhzgg
1;
diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm
index 2a52a7bca..8979fa338 100644
--- a/perllib/FixMyStreet/DB/Result/Alert.pm
+++ b/perllib/FixMyStreet/DB/Result/Alert.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("alert");
__PACKAGE__->add_columns(
"id",
@@ -65,8 +69,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2015-08-13 16:33:38
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5RNyB430T8PqtFlmGV/MUg
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pWmsXAFvvjr4x1Q3Zsu4Cg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
@@ -75,17 +79,6 @@ use namespace::clean -except => [ 'meta' ];
with 'FixMyStreet::Roles::Abuser';
-my $stz = sub {
- my ( $orig, $self ) = ( shift, shift );
- my $s = $self->$orig(@_);
- return $s unless $s && UNIVERSAL::isa($s, "DateTime");
- FixMyStreet->set_time_zone($s);
- return $s;
-};
-
-around whensubscribed => $stz;
-around whendisabled => $stz;
-
=head2 confirm
$alert->confirm();
diff --git a/perllib/FixMyStreet/DB/Result/AlertSent.pm b/perllib/FixMyStreet/DB/Result/AlertSent.pm
index 83043a33b..d4e669f7f 100644
--- a/perllib/FixMyStreet/DB/Result/AlertSent.pm
+++ b/perllib/FixMyStreet/DB/Result/AlertSent.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("alert_sent");
__PACKAGE__->add_columns(
"alert_id",
@@ -31,8 +35,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2015-08-13 16:33:38
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/+Vodu8VJxJ0EY9P3Qjjjw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xriosaSCkOo/REOG1OxdQA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/AlertType.pm b/perllib/FixMyStreet/DB/Result/AlertType.pm
index 3aa9677e0..3d9603008 100644
--- a/perllib/FixMyStreet/DB/Result/AlertType.pm
+++ b/perllib/FixMyStreet/DB/Result/AlertType.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("alert_type");
__PACKAGE__->add_columns(
"ref",
@@ -47,8 +51,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:KDBYzNEAM5lPvZjb9cv22g
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7JyCGS/rEvL1++p520749w
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/Body.pm b/perllib/FixMyStreet/DB/Result/Body.pm
index 37164c990..663181746 100644
--- a/perllib/FixMyStreet/DB/Result/Body.pm
+++ b/perllib/FixMyStreet/DB/Result/Body.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("body");
__PACKAGE__->add_columns(
"id",
@@ -18,6 +22,12 @@ __PACKAGE__->add_columns(
is_nullable => 0,
sequence => "body_id_seq",
},
+ "name",
+ { data_type => "text", is_nullable => 0 },
+ "external_url",
+ { data_type => "text", is_nullable => 1 },
+ "parent",
+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"endpoint",
{ data_type => "text", is_nullable => 1 },
"jurisdiction",
@@ -36,20 +46,14 @@ __PACKAGE__->add_columns(
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"send_extended_statuses",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
- "name",
- { data_type => "text", is_nullable => 0 },
- "parent",
- { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
- "deleted",
- { data_type => "boolean", default_value => \"false", is_nullable => 0 },
- "external_url",
- { data_type => "text", is_nullable => 1 },
"fetch_problems",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
"blank_updates_permitted",
- { data_type => "boolean", default_value => \"false", is_nullable => 1 },
+ { data_type => "boolean", default_value => \"false", is_nullable => 0 },
"convert_latlong",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "deleted",
+ { data_type => "boolean", default_value => \"false", is_nullable => 0 },
"extra",
{ data_type => "text", is_nullable => 1 },
);
@@ -126,8 +130,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-04-05 14:29:33
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HV8IM2C1ErrpvXoRTZ1B1Q
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8CuxbffDaYS7TFlgff1nEg
__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
__PACKAGE__->rabx_column('extra');
diff --git a/perllib/FixMyStreet/DB/Result/BodyArea.pm b/perllib/FixMyStreet/DB/Result/BodyArea.pm
index 4447777dc..7f0956c7d 100644
--- a/perllib/FixMyStreet/DB/Result/BodyArea.pm
+++ b/perllib/FixMyStreet/DB/Result/BodyArea.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("body_areas");
__PACKAGE__->add_columns(
"body_id",
@@ -25,8 +29,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-10 17:11:54
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+hzie6kHleUBoEt199c/nQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VPs3e9McGNO+Dd7C4pApxw
__PACKAGE__->set_primary_key(__PACKAGE__->columns);
diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm
index 31e9f3e63..5d0253ef4 100644
--- a/perllib/FixMyStreet/DB/Result/Comment.pm
+++ b/perllib/FixMyStreet/DB/Result/Comment.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("comment");
__PACKAGE__->add_columns(
"id",
@@ -89,8 +93,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-11-20 16:13:59
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5w/4Og9uCy54lGyyJiLzxA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:CozqNY621I8G7kUPXi5RoQ
#
__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
@@ -105,17 +109,6 @@ with 'FixMyStreet::Roles::Abuser',
'FixMyStreet::Roles::Moderation',
'FixMyStreet::Roles::PhotoSet';
-my $stz = sub {
- my ( $orig, $self ) = ( shift, shift );
- my $s = $self->$orig(@_);
- return $s unless $s && UNIVERSAL::isa($s, "DateTime");
- FixMyStreet->set_time_zone($s);
- return $s;
-};
-
-around created => $stz;
-around confirmed => $stz;
-
=head2 get_cobrand_logged
Get a cobrand object for the cobrand the update was made on.
diff --git a/perllib/FixMyStreet/DB/Result/Contact.pm b/perllib/FixMyStreet/DB/Result/Contact.pm
index 81f770f8f..17620f279 100644
--- a/perllib/FixMyStreet/DB/Result/Contact.pm
+++ b/perllib/FixMyStreet/DB/Result/Contact.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("contacts");
__PACKAGE__->add_columns(
"id",
@@ -24,6 +28,8 @@ __PACKAGE__->add_columns(
{ data_type => "text", default_value => "Other", is_nullable => 0 },
"email",
{ data_type => "text", is_nullable => 0 },
+ "state",
+ { data_type => "text", is_nullable => 0 },
"editor",
{ data_type => "text", is_nullable => 0 },
"whenedited",
@@ -42,8 +48,6 @@ __PACKAGE__->add_columns(
{ data_type => "text", default_value => "", is_nullable => 1 },
"send_method",
{ data_type => "text", is_nullable => 1 },
- "state",
- { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("contacts_body_id_category_idx", ["body_id", "category"]);
@@ -73,8 +77,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-07-08 20:45:04
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:t/VtPP11R8bbqPZdEVXffw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f7XjQj4iABikbR4EZrjL3g
__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
__PACKAGE__->rabx_column('extra');
diff --git a/perllib/FixMyStreet/DB/Result/ContactDefectType.pm b/perllib/FixMyStreet/DB/Result/ContactDefectType.pm
index 2199f0b42..25d842e23 100644
--- a/perllib/FixMyStreet/DB/Result/ContactDefectType.pm
+++ b/perllib/FixMyStreet/DB/Result/ContactDefectType.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("contact_defect_types");
__PACKAGE__->add_columns(
"id",
@@ -38,8 +42,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-02-13 15:11:11
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VIczmM0OXXpWgQVpop3SMw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yjQ/+17jn8fW8J70fFtvgg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/ContactResponsePriority.pm b/perllib/FixMyStreet/DB/Result/ContactResponsePriority.pm
index d5afd75a7..8406e2762 100644
--- a/perllib/FixMyStreet/DB/Result/ContactResponsePriority.pm
+++ b/perllib/FixMyStreet/DB/Result/ContactResponsePriority.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("contact_response_priorities");
__PACKAGE__->add_columns(
"id",
@@ -38,8 +42,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-09-06 15:33:04
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kM/9jY1QSgakyPTvutS+hw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NvXWYJu14GUXEHztl3Zp4w
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/ContactResponseTemplate.pm b/perllib/FixMyStreet/DB/Result/ContactResponseTemplate.pm
index 3c777533c..3139b2c84 100644
--- a/perllib/FixMyStreet/DB/Result/ContactResponseTemplate.pm
+++ b/perllib/FixMyStreet/DB/Result/ContactResponseTemplate.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("contact_response_templates");
__PACKAGE__->add_columns(
"id",
@@ -38,8 +42,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-08-24 11:29:04
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d6niNsxi2AsijhvJSuQeKw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PE5+8AZp77pb+tDFEwiOqg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm
index c90bb9d66..5a6039d6a 100644
--- a/perllib/FixMyStreet/DB/Result/ContactsHistory.pm
+++ b/perllib/FixMyStreet/DB/Result/ContactsHistory.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("contacts_history");
__PACKAGE__->add_columns(
"contacts_history_id",
@@ -26,20 +30,20 @@ __PACKAGE__->add_columns(
{ data_type => "text", default_value => "Other", is_nullable => 0 },
"email",
{ data_type => "text", is_nullable => 0 },
+ "state",
+ { data_type => "text", is_nullable => 0 },
"editor",
{ data_type => "text", is_nullable => 0 },
"whenedited",
{ data_type => "timestamp", is_nullable => 0 },
"note",
{ data_type => "text", is_nullable => 0 },
- "state",
- { data_type => "text", is_nullable => 0 },
);
__PACKAGE__->set_primary_key("contacts_history_id");
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-07-08 20:45:04
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HTt0g29yXTM/WyHKN179FA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:es6F6L3MS8pEUDprFplnYg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/DefectType.pm b/perllib/FixMyStreet/DB/Result/DefectType.pm
index a2969f59e..baee066af 100644
--- a/perllib/FixMyStreet/DB/Result/DefectType.pm
+++ b/perllib/FixMyStreet/DB/Result/DefectType.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("defect_types");
__PACKAGE__->add_columns(
"id",
@@ -49,8 +53,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-02-13 15:11:11
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BBLjb/aAoTKJZerdYCeBMQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:d5Gkeysiz/1P/Ww4Xur0vA
__PACKAGE__->many_to_many( contacts => 'contact_defect_types', 'contact' );
diff --git a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm
index d947c4f6b..18d2a7683 100644
--- a/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm
+++ b/perllib/FixMyStreet/DB/Result/ModerationOriginalData.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("moderation_original_data");
__PACKAGE__->add_columns(
"id",
@@ -66,8 +70,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2018-11-20 16:13:59
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zFOhQnS4WfVzD7qHxaAr6w
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FLKiZELcfBcc9VwHU2MZYQ
use Moo;
use Text::Diff;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index a222ea1f6..dc45091ee 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("problem");
__PACKAGE__->add_columns(
"id",
@@ -20,14 +24,38 @@ __PACKAGE__->add_columns(
},
"postcode",
{ data_type => "text", is_nullable => 0 },
+ "latitude",
+ { data_type => "double precision", is_nullable => 0 },
+ "longitude",
+ { data_type => "double precision", is_nullable => 0 },
+ "bodies_str",
+ { data_type => "text", is_nullable => 1 },
+ "bodies_missing",
+ { data_type => "text", is_nullable => 1 },
+ "areas",
+ { data_type => "text", is_nullable => 0 },
+ "category",
+ { data_type => "text", default_value => "Other", is_nullable => 0 },
"title",
{ data_type => "text", is_nullable => 0 },
"detail",
{ data_type => "text", is_nullable => 0 },
"photo",
{ data_type => "bytea", is_nullable => 1 },
+ "used_map",
+ { data_type => "boolean", is_nullable => 0 },
+ "user_id",
+ { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"name",
{ data_type => "text", is_nullable => 0 },
+ "anonymous",
+ { data_type => "boolean", is_nullable => 0 },
+ "external_id",
+ { data_type => "text", is_nullable => 1 },
+ "external_body",
+ { data_type => "text", is_nullable => 1 },
+ "external_team",
+ { data_type => "text", is_nullable => 1 },
"created",
{
data_type => "timestamp",
@@ -35,57 +63,37 @@ __PACKAGE__->add_columns(
is_nullable => 0,
original => { default_value => \"now()" },
},
- "state",
- { data_type => "text", is_nullable => 0 },
- "whensent",
- { data_type => "timestamp", is_nullable => 1 },
- "used_map",
- { data_type => "boolean", is_nullable => 0 },
- "bodies_str",
- { data_type => "text", is_nullable => 1 },
- "anonymous",
- { data_type => "boolean", is_nullable => 0 },
- "category",
- { data_type => "text", default_value => "Other", is_nullable => 0 },
"confirmed",
{ data_type => "timestamp", is_nullable => 1 },
- "send_questionnaire",
- { data_type => "boolean", default_value => \"true", is_nullable => 0 },
- "lastupdate",
- {
- data_type => "timestamp",
- default_value => \"current_timestamp",
- is_nullable => 0,
- original => { default_value => \"now()" },
- },
- "areas",
+ "state",
{ data_type => "text", is_nullable => 0 },
- "service",
- { data_type => "text", default_value => "", is_nullable => 0 },
"lang",
{ data_type => "text", default_value => "en-gb", is_nullable => 0 },
+ "service",
+ { data_type => "text", default_value => "", is_nullable => 0 },
"cobrand",
{ data_type => "text", default_value => "", is_nullable => 0 },
"cobrand_data",
{ data_type => "text", default_value => "", is_nullable => 0 },
- "latitude",
- { data_type => "double precision", is_nullable => 0 },
- "longitude",
- { data_type => "double precision", is_nullable => 0 },
- "external_id",
- { data_type => "text", is_nullable => 1 },
- "external_body",
- { data_type => "text", is_nullable => 1 },
- "external_team",
+ "lastupdate",
+ {
+ data_type => "timestamp",
+ default_value => \"current_timestamp",
+ is_nullable => 0,
+ original => { default_value => \"now()" },
+ },
+ "whensent",
+ { data_type => "timestamp", is_nullable => 1 },
+ "send_questionnaire",
+ { data_type => "boolean", default_value => \"true", is_nullable => 0 },
+ "extra",
{ data_type => "text", is_nullable => 1 },
- "user_id",
- { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
"flagged",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
- "extra",
- { data_type => "text", is_nullable => 1 },
"geocode",
{ data_type => "bytea", is_nullable => 1 },
+ "response_priority_id",
+ { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"send_fail_count",
{ data_type => "integer", default_value => 0, is_nullable => 0 },
"send_fail_reason",
@@ -104,10 +112,6 @@ __PACKAGE__->add_columns(
{ data_type => "integer", default_value => 0, is_nullable => 1 },
"subcategory",
{ data_type => "text", is_nullable => 1 },
- "bodies_missing",
- { data_type => "text", is_nullable => 1 },
- "response_priority_id",
- { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
"defect_type_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
);
@@ -166,8 +170,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-02-13 15:11:11
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8zzWlJX7OQOdvrGxKuZUmg
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hUXle+TtlkDkxkBrVa/u+g
# Add fake relationship to stored procedure table
__PACKAGE__->has_one(
@@ -323,19 +327,6 @@ sub visible_states_remove {
}
}
-my $stz = sub {
- my ( $orig, $self ) = ( shift, shift );
- my $s = $self->$orig(@_);
- return $s unless $s && UNIVERSAL::isa($s, "DateTime");
- FixMyStreet->set_time_zone($s);
- return $s;
-};
-
-around created => $stz;
-around confirmed => $stz;
-around whensent => $stz;
-around lastupdate => $stz;
-
around service => sub {
my ( $orig, $self ) = ( shift, shift );
# service might be undef if e.g. unsaved code report
diff --git a/perllib/FixMyStreet/DB/Result/Questionnaire.pm b/perllib/FixMyStreet/DB/Result/Questionnaire.pm
index 6b7ab9452..2d5445669 100644
--- a/perllib/FixMyStreet/DB/Result/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/Result/Questionnaire.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("questionnaire");
__PACKAGE__->add_columns(
"id",
@@ -40,23 +44,12 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2013-09-10 17:11:54
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oL1Hk4/bNG14CY74GA75SA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AWRb6itjsVkG5VUDRmBTIg
use Moo;
use namespace::clean -except => [ 'meta' ];
-my $stz = sub {
- my ( $orig, $self ) = ( shift, shift );
- my $s = $self->$orig(@_);
- return $s unless $s && UNIVERSAL::isa($s, "DateTime");
- FixMyStreet->set_time_zone($s);
- return $s;
-};
-
-around whensent => $stz;
-around whenanswered => $stz;
-
sub marks_fixed {
my $self = shift;
my $new_fixed = FixMyStreet::DB::Result::Problem->fixed_states()->{$self->new_state};
diff --git a/perllib/FixMyStreet/DB/Result/ReportExtraFields.pm b/perllib/FixMyStreet/DB/Result/ReportExtraField.pm
index 27a6bd2c6..f88169bba 100644
--- a/perllib/FixMyStreet/DB/Result/ReportExtraFields.pm
+++ b/perllib/FixMyStreet/DB/Result/ReportExtraField.pm
@@ -1,5 +1,5 @@
use utf8;
-package FixMyStreet::DB::Result::ReportExtraFields;
+package FixMyStreet::DB::Result::ReportExtraField;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("report_extra_fields");
__PACKAGE__->add_columns(
"id",
@@ -30,8 +34,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("id");
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-07-28 09:51:34
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LkfbsUInnEyXowdcCEPjUQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 15:41:27
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:yRF676ybdkfalMwZ9V+yhw
__PACKAGE__->load_components("+FixMyStreet::DB::RABXColumn");
__PACKAGE__->rabx_column('extra');
diff --git a/perllib/FixMyStreet/DB/Result/ResponsePriority.pm b/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
index df54cfa08..a478ac7b9 100644
--- a/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
+++ b/perllib/FixMyStreet/DB/Result/ResponsePriority.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("response_priorities");
__PACKAGE__->add_columns(
"id",
@@ -20,10 +24,10 @@ __PACKAGE__->add_columns(
},
"body_id",
{ data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
- "name",
- { data_type => "text", is_nullable => 0 },
"deleted",
{ data_type => "boolean", default_value => \"false", is_nullable => 0 },
+ "name",
+ { data_type => "text", is_nullable => 0 },
"description",
{ data_type => "text", is_nullable => 1 },
"external_id",
@@ -53,8 +57,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-09-12 09:32:53
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:JBIHFnaLvXCAUjgwTSB3CQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gIttzSJcQ8GxTowrQZ8oAw
__PACKAGE__->many_to_many( contacts => 'contact_response_priorities', 'contact' );
diff --git a/perllib/FixMyStreet/DB/Result/ResponseTemplate.pm b/perllib/FixMyStreet/DB/Result/ResponseTemplate.pm
index 73e0d898e..85bf80aef 100644
--- a/perllib/FixMyStreet/DB/Result/ResponseTemplate.pm
+++ b/perllib/FixMyStreet/DB/Result/ResponseTemplate.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("response_templates");
__PACKAGE__->add_columns(
"id",
@@ -54,8 +58,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07048 @ 2018-03-22 11:18:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:p0+/jFma6H9eZ3MZAJQRaQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MzTa7p2rryKkxbRi7zN+Uw
__PACKAGE__->many_to_many( contacts => 'contact_response_templates', 'contact' );
diff --git a/perllib/FixMyStreet/DB/Result/Secret.pm b/perllib/FixMyStreet/DB/Result/Secret.pm
index 449dfec0e..045375fef 100644
--- a/perllib/FixMyStreet/DB/Result/Secret.pm
+++ b/perllib/FixMyStreet/DB/Result/Secret.pm
@@ -8,13 +8,17 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("secret");
__PACKAGE__->add_columns("secret", { data_type => "text", is_nullable => 0 });
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9XiWSKJ1PD3LSYjrSA3drw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mVU/XGxS3DVhEcHTA2srgA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/Session.pm b/perllib/FixMyStreet/DB/Result/Session.pm
index a478c5444..94f7e823c 100644
--- a/perllib/FixMyStreet/DB/Result/Session.pm
+++ b/perllib/FixMyStreet/DB/Result/Session.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("sessions");
__PACKAGE__->add_columns(
"id",
@@ -21,8 +25,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("id");
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:MVmCn4gLQWXTDIIaDHiVmA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HoYrCwULpxJVJ1m9ASMk3A
use Storable;
use MIME::Base64;
diff --git a/perllib/FixMyStreet/DB/Result/State.pm b/perllib/FixMyStreet/DB/Result/State.pm
index b8a35d42b..66477111b 100644
--- a/perllib/FixMyStreet/DB/Result/State.pm
+++ b/perllib/FixMyStreet/DB/Result/State.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("state");
__PACKAGE__->add_columns(
"id",
@@ -30,8 +34,8 @@ __PACKAGE__->add_unique_constraint("state_label_key", ["label"]);
__PACKAGE__->add_unique_constraint("state_name_key", ["name"]);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-08-22 15:17:43
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dvtAOpeYqEF9T3otHHgLqw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:f/QeR3FYL/4wIGRu3c/C/A
use Moo;
use namespace::clean;
diff --git a/perllib/FixMyStreet/DB/Result/Token.pm b/perllib/FixMyStreet/DB/Result/Token.pm
index a60e23839..444d5e5a8 100644
--- a/perllib/FixMyStreet/DB/Result/Token.pm
+++ b/perllib/FixMyStreet/DB/Result/Token.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("token");
__PACKAGE__->add_columns(
"scope",
@@ -28,8 +32,8 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("scope", "token");
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2015-08-13 16:33:38
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HkvzOY5STjOdXN64hxg5NA
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:km/1K3PurX8bbgnYPWgLIA
use mySociety::AuthToken;
diff --git a/perllib/FixMyStreet/DB/Result/Translation.pm b/perllib/FixMyStreet/DB/Result/Translation.pm
index fafc7ccf1..4d6373d40 100644
--- a/perllib/FixMyStreet/DB/Result/Translation.pm
+++ b/perllib/FixMyStreet/DB/Result/Translation.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("translation");
__PACKAGE__->add_columns(
"id",
@@ -36,8 +40,8 @@ __PACKAGE__->add_unique_constraint(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2017-07-14 23:24:32
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:///VNqg4BOuO29xKhnY8vw
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:EsseG51ZpQa5QYHPCpkL8A
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 546867c34..d01ba92d0 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("users");
__PACKAGE__->add_columns(
"id",
@@ -56,10 +60,10 @@ __PACKAGE__->add_columns(
{ data_type => "bigint", is_nullable => 1 },
"facebook_id",
{ data_type => "bigint", is_nullable => 1 },
- "area_ids",
- { data_type => "integer[]", is_nullable => 1 },
"extra",
{ data_type => "text", is_nullable => 1 },
+ "area_ids",
+ { data_type => "integer[]", is_nullable => 1 },
);
__PACKAGE__->set_primary_key("id");
__PACKAGE__->add_unique_constraint("users_facebook_id_key", ["facebook_id"]);
@@ -119,8 +123,8 @@ __PACKAGE__->has_many(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-02-12 15:14:37
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:4NBO3A+LfZXOh4Kj/II2LQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BCCqv3JCec8psuRk/SdCJQ
# These are not fully unique constraints (they only are when the *_verified
# is true), but this is managed in ResultSet::User's find() wrapper.
diff --git a/perllib/FixMyStreet/DB/Result/UserBodyPermission.pm b/perllib/FixMyStreet/DB/Result/UserBodyPermission.pm
index a118a1996..8fdabbdda 100644
--- a/perllib/FixMyStreet/DB/Result/UserBodyPermission.pm
+++ b/perllib/FixMyStreet/DB/Result/UserBodyPermission.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("user_body_permissions");
__PACKAGE__->add_columns(
"id",
@@ -44,8 +48,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2014-06-05 15:46:02
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IWy2rYBU7WP6MyIkLYsc9Q
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mcgnPaCmEuLWdzB3GuQiTg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/Result/UserPlannedReport.pm b/perllib/FixMyStreet/DB/Result/UserPlannedReport.pm
index 1e893c7a9..cd1716f02 100644
--- a/perllib/FixMyStreet/DB/Result/UserPlannedReport.pm
+++ b/perllib/FixMyStreet/DB/Result/UserPlannedReport.pm
@@ -8,7 +8,11 @@ use strict;
use warnings;
use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn");
+__PACKAGE__->load_components(
+ "FilterColumn",
+ "FixMyStreet::InflateColumn::DateTime",
+ "FixMyStreet::EncodedColumn",
+);
__PACKAGE__->table("user_planned_reports");
__PACKAGE__->add_columns(
"id",
@@ -47,8 +51,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07035 @ 2016-07-20 15:03:08
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:mv7koDhvZSBW/4aQivtpAQ
+# Created by DBIx::Class::Schema::Loader v0.07035 @ 2019-04-25 12:06:39
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:A9ICDFNVzkmd/erdtYdeVA
# You can replace this text with custom code or comments, and it will be preserved on regeneration
diff --git a/perllib/FixMyStreet/DB/ResultSet/ReportExtraFields.pm b/perllib/FixMyStreet/DB/ResultSet/ReportExtraField.pm
index 1348df3c2..9c47b1894 100644
--- a/perllib/FixMyStreet/DB/ResultSet/ReportExtraFields.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/ReportExtraField.pm
@@ -1,4 +1,4 @@
-package FixMyStreet::DB::ResultSet::ReportExtraFields;
+package FixMyStreet::DB::ResultSet::ReportExtraField;
use base 'DBIx::Class::ResultSet';
use strict;
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index 263877e0a..3b436aaa7 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -94,7 +94,8 @@ sub update_comments {
next unless $request_id || $request->{fixmystreet_id};
my $comment_time = eval {
- DateTime::Format::W3CDTF->parse_datetime( $request->{updated_datetime} || "" );
+ DateTime::Format::W3CDTF->parse_datetime( $request->{updated_datetime} || "" )
+ ->set_time_zone(FixMyStreet->local_time_zone);
};
next if $@;
my $updated = DateTime::Format::W3CDTF->format_datetime($comment_time->clone->set_time_zone('UTC'));
@@ -190,7 +191,12 @@ sub update_comments {
$comment->state('hidden') unless $comment->text || $comment->photo
|| ($comment->problem_state && $state ne $old_state);
- $p->lastupdate( $comment->created );
+ # As comment->created has been looked at above, its time zone has been shifted
+ # to TIME_ZONE (if set). We therefore need to set it back to local before
+ # insertion. We also then need a clone, otherwise the setting of lastupdate
+ # will *also* reshift comment->created's time zone to TIME_ZONE.
+ my $created = $comment->created->set_time_zone(FixMyStreet->local_time_zone);
+ $p->lastupdate($created->clone);
$p->update;
$comment->insert();
diff --git a/perllib/Open311/GetServiceRequests.pm b/perllib/Open311/GetServiceRequests.pm
index 215361a10..194d8d296 100644
--- a/perllib/Open311/GetServiceRequests.pm
+++ b/perllib/Open311/GetServiceRequests.pm
@@ -109,9 +109,7 @@ sub create_problems {
my $updated_time = eval {
DateTime::Format::W3CDTF->parse_datetime(
$request->{updated_datetime} || ""
- )->set_time_zone(
- FixMyStreet->time_zone || FixMyStreet->local_time_zone
- );
+ )->set_time_zone(FixMyStreet->local_time_zone);
};
if ($@) {
warn "Not creating problem $request_id for @{[$body->name]}, bad update time"
@@ -125,9 +123,7 @@ sub create_problems {
my $created_time = eval {
DateTime::Format::W3CDTF->parse_datetime(
$request->{requested_datetime} || ""
- )->set_time_zone(
- FixMyStreet->time_zone || FixMyStreet->local_time_zone
- );
+ )->set_time_zone(FixMyStreet->local_time_zone);
};
$created_time = $updated_time if $@;
diff --git a/t/app/controller/admin/reportextrafields.t b/t/app/controller/admin/reportextrafields.t
index 4549eeadf..e02df864f 100644
--- a/t/app/controller/admin/reportextrafields.t
+++ b/t/app/controller/admin/reportextrafields.t
@@ -151,9 +151,11 @@ FixMyStreet::override_config {
subtest 'Create and update new ReportExtraFields' => sub {
my $extra_fields = [];
- my $model = FixMyStreet::App->model('DB::ReportExtraFields');
+ my $model = FixMyStreet::App->model('DB::ReportExtraField');
is $model->count, 0, 'no ReportExtraFields yet';
+ $mech->get_ok("/admin/reportextrafields");
+
$mech->get_ok("/admin/reportextrafields/new");
$mech->submit_form_ok({ with_fields => {
name => "Test extra fields",
@@ -289,7 +291,7 @@ FixMyStreet::override_config {
LANGUAGES => [ 'en-gb,English,en_GB' ]
}, sub {
subtest "Extra fields are missing from cobrand that doesn't allow them" => sub {
- my $object = FixMyStreet::App->model('DB::ReportExtraFields')->first;
+ my $object = FixMyStreet::App->model('DB::ReportExtraField')->first;
$object->update({ language => "", cobrand => ""});
$mech->get_ok("/report/new?longitude=-1.351488&latitude=51.847235&category=" . $contact->category);
@@ -298,7 +300,7 @@ FixMyStreet::override_config {
};
};
-FixMyStreet::App->model('DB::ReportExtraFields')->delete_all;
+FixMyStreet::App->model('DB::ReportExtraField')->delete_all;
$mech->log_out_ok;
subtest 'Reports are created with correct extra metadata' => sub {
@@ -306,7 +308,7 @@ subtest 'Reports are created with correct extra metadata' => sub {
ALLOWED_COBRANDS => [ 'tester' ],
MAPIT_URL => 'http://mapit.uk/',
}, sub {
- my $model = FixMyStreet::App->model('DB::ReportExtraFields');
+ my $model = FixMyStreet::App->model('DB::ReportExtraField');
my $extra_fields = $model->find_or_create({
name => "Test extra fields",
language => "",
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index f816c5317..f77114d86 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -366,11 +366,8 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
}
}
- my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2);
+ my $dt = DateTime->now()->add(days => 2);
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
-
- my $report_time = '2011-03-01 12:00:00';
my ($report) = $mech->create_problems_for_body(1, 1, 'Testing', {
dt => $dt,
user => $user1,
@@ -378,8 +375,8 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
state => 'fixed - user',
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
+ lastupdate => $dt,
+ whensent => $dt->clone->add( minutes => 5 ),
latitude => '55.951963',
longitude => '-3.189944',
});
@@ -441,60 +438,13 @@ subtest "Test alerts are not sent for no-text updates" => sub {
my $user1 = $mech->create_user_ok('reporter@example.com', name => 'Reporter User' );
my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User' );
my $user3 = $mech->create_user_ok('staff@example.com', name => 'Staff User', from_body => $gloucester );
- my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2);
-
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
+ my $dt = DateTime->now()->add(days => 2);
- my $report_time = '2011-03-01 12:00:00';
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => '1',
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Testing',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user1->name,
- anonymous => 0,
- state => 'fixed - user',
- confirmed => $dt_parser->format_datetime($dt),
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user1->id,
- } );
+ my ($report, $report2) = $mech->create_problems_for_body(2, 1, 'Testing', {
+ user => $user1,
+ });
my $report_id = $report->id;
ok $report, "created test report - $report_id";
-
- my $report2 = FixMyStreet::App->model('DB::Problem')->create( {
- postcode => 'EH1 1BB',
- bodies_str => '1',
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Testing',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user1->name,
- anonymous => 0,
- state => 'fixed - user',
- confirmed => $dt_parser->format_datetime($dt),
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user1->id,
- } );
my $report2_id = $report2->id;
ok $report2, "created test report - $report2_id";
@@ -534,34 +484,11 @@ subtest "Test no marked as confirmed added to alerts" => sub {
my $user1 = $mech->create_user_ok('reporter@example.com', name => 'Reporter User' );
my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User' );
my $user3 = $mech->create_user_ok('staff@example.com', name => 'Staff User', from_body => $gloucester );
- my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2);
-
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
+ my $dt = DateTime->now()->add(days => 2);
- my $report_time = '2011-03-01 12:00:00';
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => '1',
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Testing',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user1->name,
- anonymous => 0,
- state => 'confirmed',
- confirmed => $dt_parser->format_datetime($dt),
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user1->id,
- } );
+ my ($report) = $mech->create_problems_for_body(1, 1, 'Testing', {
+ user => $user1,
+ });
my $report_id = $report->id;
ok $report, "created test report - $report_id";
@@ -617,34 +544,11 @@ for my $test (
my $user1 = $mech->create_user_ok('reporter@example.com', name => 'Reporter User' );
my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User' );
my $user3 = $mech->create_user_ok('staff@example.com', name => 'Staff User', from_body => $gloucester );
- my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2);
-
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
+ my $dt = DateTime->now()->add(days => 2);
- my $report_time = '2011-03-01 12:00:00';
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => '1',
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Testing',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user1->name,
- anonymous => 0,
- state => 'confirmed',
- confirmed => $dt_parser->format_datetime($dt),
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user1->id,
- } );
+ my ($report) = $mech->create_problems_for_body(1, 1, 'Testing', {
+ user => $user1,
+ });
my $report_id = $report->id;
ok $report, "created test report - $report_id";
@@ -685,34 +589,11 @@ subtest "Test signature template is used from cobrand" => sub {
my $user1 = $mech->create_user_ok('reporter@example.com', name => 'Reporter User' );
my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User' );
- my $dt = DateTime->now(time_zone => 'Europe/London')->add(days => 2);
+ my $dt = DateTime->now()->add(days => 2);
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
-
- my $report_time = '2011-03-01 12:00:00';
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => $body->id,
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Testing',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user1->name,
- anonymous => 0,
- state => 'fixed - user',
- confirmed => $dt_parser->format_datetime($dt),
- lastupdate => $dt_parser->format_datetime($dt),
- whensent => $dt_parser->format_datetime($dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user1->id,
- } );
+ my ($report) = $mech->create_problems_for_body(1, $body->id, 'Testing', {
+ user => $user1,
+ });
my $report_id = $report->id;
ok $report, "created test report - $report_id";
@@ -797,7 +678,7 @@ for my $test (
my $user1 = $mech->create_user_ok('reporter@example.com', name => 'Reporter User');
my $user2 = $mech->create_user_ok('alerts@example.com', name => 'Alert User');
- my $dt = DateTime->now->add( minutes => -30 );
+ my $dt = DateTime->now()->add( minutes => -30 );
my $r_dt = $dt->clone->add( minutes => 20 );
my $alert_params = $test->{alert_params};
@@ -808,32 +689,15 @@ for my $test (
my $alert_user1 = FixMyStreet::App->model('DB::Alert')->create( $alert_params );
ok $alert_user1, "alert created";
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
-
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => $body->id,
+ my ($report) = $mech->create_problems_for_body(1, $body->id, 'Testing', {
areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
title => 'Alert test for non public reports',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user2->name,
- anonymous => 0,
- state => 'confirmed',
- confirmed => $dt_parser->format_datetime($r_dt),
- lastupdate => $dt_parser->format_datetime($r_dt),
- whensent => $dt_parser->format_datetime($r_dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
+ confirmed => $r_dt, # Needed so timezone set right
latitude => '55.951963',
longitude => '-3.189944',
- user_id => $user2->id,
+ user => $user2,
non_public => 1,
- } );
+ });
$mech->clear_emails_ok;
FixMyStreet::override_config {
@@ -865,32 +729,10 @@ subtest 'check new updates alerts for non public reports only go to report owner
my $dt = DateTime->now->add( minutes => -30 );
my $r_dt = $dt->clone->add( minutes => 20 );
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
-
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => $body->id,
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Alert test for non public reports',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user2->name,
- anonymous => 0,
- state => 'confirmed',
- confirmed => $dt_parser->format_datetime($r_dt),
- lastupdate => $dt_parser->format_datetime($r_dt),
- whensent => $dt_parser->format_datetime($r_dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user2->id,
- non_public => 1,
- } );
+ my ($report) = $mech->create_problems_for_body(1, $body->id, 'Testing', {
+ user => $user2,
+ non_public => 1,
+ });
$mech->create_comment_for_problem($report, $user3, 'Anonymous User', 'This is some more update text', 't', 'confirmed', undef, { confirmed => $r_dt->clone->add( minutes => 8 ) });
@@ -903,7 +745,6 @@ subtest 'check new updates alerts for non public reports only go to report owner
} );
ok $alert_user1, "alert created";
-
$mech->clear_emails_ok;
FixMyStreet::App->model('DB::AlertType')->email_alerts();
$mech->email_count_is(0);
@@ -945,33 +786,11 @@ subtest 'check setting include dates in new updates cobrand option' => sub {
my $dt = DateTime->now->add( minutes => -30 );
my $r_dt = $dt->clone->add( minutes => 20 );
- my $dt_parser = FixMyStreet::App->model('DB')->schema->storage->datetime_parser;
-
- my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
- postcode => 'EH1 1BB',
- bodies_str => $body->id,
- areas => ',11808,135007,14419,134935,2651,20728,',
- category => 'Street lighting',
- title => 'Alert test for non public reports',
- detail => 'Testing Detail',
- used_map => 1,
- name => $user2->name,
- anonymous => 0,
- state => 'confirmed',
- confirmed => $dt_parser->format_datetime($r_dt),
- lastupdate => $dt_parser->format_datetime($r_dt),
- whensent => $dt_parser->format_datetime($r_dt->clone->add( minutes => 5 )),
- lang => 'en-gb',
- service => '',
- cobrand => 'default',
- cobrand_data => '',
- send_questionnaire => 1,
- latitude => '55.951963',
- longitude => '-3.189944',
- user_id => $user2->id,
- } );
+ my ($report) = $mech->create_problems_for_body(1, $body->id, 'Testing', {
+ user => $user2,
+ });
- my $update = $mech->create_comment_for_problem($report, $user3, 'Anonymous User', 'This is some more update text', 't', 'confirmed', undef, { confirmed => $r_dt->clone->add( minutes => 8 ) });
+ my $update = $mech->create_comment_for_problem($report, $user3, 'Anonymous User', 'This is some more update text', 't', 'confirmed', undef, { confirmed => $r_dt });
my $alert_user1 = FixMyStreet::App->model('DB::Alert')->create( {
user => $user1,
@@ -986,13 +805,6 @@ subtest 'check setting include dates in new updates cobrand option' => sub {
$mech->clear_emails_ok;
FixMyStreet::App->model('DB::AlertType')->email_alerts();
- # if we don't do this then we're applying the date inflation code and
- # it's timezone munging to the DateTime object above and not the DateTime
- # object that's inflated from the database value and these turn out to be
- # different as the one above has a UTC timezone and not the floating one
- # that those from the DB do.
- $update->discard_changes();
-
my $date_in_alert = Utils::prettify_dt( $update->confirmed );
my $email = $mech->get_text_body_from_email;
like $email, qr/$date_in_alert/, 'alert contains date';
diff --git a/t/app/controller/contact.t b/t/app/controller/contact.t
index bf157d699..842f27dd5 100644
--- a/t/app/controller/contact.t
+++ b/t/app/controller/contact.t
@@ -448,6 +448,7 @@ for my $test (
token => $csrf,
dest => 'from_council',
success_url => '/faq',
+ s => "",
},
url_should_be => 'http://localhost/faq',
},
@@ -457,6 +458,7 @@ for my $test (
token => $csrf,
dest => 'from_council',
success_url => 'http://www.example.com',
+ s => "",
},
url_should_be => 'http://www.example.com',
},
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 397dd1b00..ef05288c7 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -749,7 +749,7 @@ FixMyStreet::override_config {
# set the timezone on this so the date comparison below doesn't fail due to mismatched
# timezones
my $now = DateTime->now(
- time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone
+ time_zone => FixMyStreet->local_time_zone
)->subtract(days => 1);
$mech->submit_form(button => 'save', form_id => 'report_inspect_form',
fields => { include_update => 1, public_update => 'An update', saved_at => $now->epoch });
diff --git a/t/open311/getservicerequests.t b/t/open311/getservicerequests.t
index f4eae59b1..55bb9ba11 100644
--- a/t/open311/getservicerequests.t
+++ b/t/open311/getservicerequests.t
@@ -76,13 +76,9 @@ my $o = Open311->new(
);
my $p1_date = $dtf->parse_datetime('2010-04-14T06:37:38-08:00')
- ->set_time_zone(
- FixMyStreet->time_zone || FixMyStreet->local_time_zone
- );
+ ->set_time_zone(FixMyStreet->local_time_zone);
my $p2_date = $dtf->parse_datetime('2010-04-15T06:37:38-08:00')
- ->set_time_zone(
- FixMyStreet->time_zone || FixMyStreet->local_time_zone
- );
+ ->set_time_zone(FixMyStreet->local_time_zone);
my $start_date = $p1_date->clone;
$start_date->add( hours => -2);
my $end_date = $p2_date->clone;
@@ -96,6 +92,7 @@ subtest 'basic parsing checks' => sub {
end_date => $end_date
);
FixMyStreet::override_config {
+ TIME_ZONE => 'Asia/Tokyo',
MAPIT_URL => 'http://mapit.uk/',
}, sub {
$update->create_problems( $o, $body );
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index 573e23cfc..f680985a4 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -557,7 +557,11 @@ subtest 'date for comment correct' => sub {
my $o = Open311->new( jurisdiction => 'mysociety', endpoint => 'http://example.com', test_mode => 1, test_get_returns => { 'servicerequestupdates.xml' => $local_requests_xml } );
my $update = Open311::GetServiceRequestUpdates->new( system_user => $user );
- $update->update_comments( $o, $bodies{2482} );
+ FixMyStreet::override_config {
+ TIME_ZONE => 'Australia/Sydney',
+ }, sub {
+ $update->update_comments( $o, $bodies{2482} );
+ };
my $comment = $problem->comments->first;
is $comment->created, $dt, 'created date set to date from XML';