diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 25cf6e8b2..c1ecd6576 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -104,6 +104,11 @@ __PACKAGE__->has_many( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U3aYCRwE4etekKaHdhEkIw use DateTime::TimeZone; +use Moose; +use namespace::clean -except => [ 'meta' ]; + +with 'FixMyStreet::Roles::Abuser'; + my $tz = DateTime::TimeZone->new( name => "local" ); sub confirmed_local { @@ -178,30 +183,6 @@ sub check_for_errors { return \%errors; } -=head2 is_from_abuser - - $bool = $problem->is_from_abuser( ); - -Returns true if the user's email or its domain is listed in the 'abuse' table. - -=cut - -sub is_from_abuser { - my $self = shift; - - # get the domain - my $email = $self->user->email; - my ($domain) = $email =~ m{ @ (.*) \z }x; - - # search for an entry in the abuse table - my $abuse_rs = $self->result_source->schema->resultset('Abuse'); - - return - $abuse_rs->find( { email => $email } ) - || $abuse_rs->find( { email => $domain } ) - || undef; -} - =head2 confirm $bool = $problem->confirm( ); @@ -366,4 +347,7 @@ sub duration_string { ); } +# we need the inline_constructor bit as we don't inherit from Moose +__PACKAGE__->meta->make_immutable( inline_constructor => 0 ); + 1; |