aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/Result/Token.pm5
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm4
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm10
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm6
4 files changed, 8 insertions, 17 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Token.pm b/perllib/FixMyStreet/DB/Result/Token.pm
index 5525fe7a5..0156af137 100644
--- a/perllib/FixMyStreet/DB/Result/Token.pm
+++ b/perllib/FixMyStreet/DB/Result/Token.pm
@@ -30,9 +30,6 @@ __PACKAGE__->set_primary_key("scope", "token");
# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-08 17:19:55
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+LLZ8P5GXqPetuGyrra2vw
-# Trying not to use this
-# use mySociety::DBHandle qw(dbh);
-
use mySociety::AuthToken;
=head1 NAME
@@ -43,8 +40,6 @@ FixMyStreet::DB::Result::Token
Representation of mySociety::AuthToken in the DBIx::Class world.
-Mostly done so that we don't need to use mySociety::DBHandle.
-
The 'data' value is automatically inflated and deflated in the same way that the
AuthToken would do it. 'token' is set to a new random value by default and the
'created' timestamp is achieved using the database function
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 5bed95811..b704fa7dd 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -5,7 +5,6 @@ use strict;
use warnings;
use mySociety::DBHandle qw(dbh);
-use mySociety::EmailUtil;
use mySociety::Gaze;
use mySociety::Locale;
use mySociety::MaPit;
@@ -262,13 +261,12 @@ sub _send_aggregated_alert_email(%) {
To => $data{alert_email},
},
$sender,
- [ $data{alert_email} ],
0,
$cobrand,
$data{lang}
);
- if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) {
+ unless ($result) {
$token->insert();
} else {
print "Failed to send alert $data{alert_id}!";
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 5d70bf47d..a84a309ee 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -8,7 +8,6 @@ use CronFns;
use Utils;
use mySociety::Config;
-use mySociety::EmailUtil;
use mySociety::MaPit;
use FixMyStreet::App;
@@ -323,6 +322,10 @@ sub send_reports {
$h{user_details} .= sprintf(_('Email: %s'), $row->user->email) . "\n\n";
}
+ if ($cobrand->can('process_additional_metadata_for_email')) {
+ $cobrand->process_additional_metadata_for_email($row, \%h);
+ }
+
my %reporters = ();
my ( $sender_count );
if ($site eq 'emptyhomes') {
@@ -434,7 +437,7 @@ sub send_reports {
}
}
- if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) {
+ unless ($result) {
$row->update( {
whensent => \'ms_current_timestamp()',
lastupdate => \'ms_current_timestamp()',
@@ -497,7 +500,7 @@ sub _send_report_sent_email {
my $template = FixMyStreet->get_email_template($row->cobrand, $row->lang, 'confirm_report_sent.txt');
- my $result = FixMyStreet::App->send_email_cron(
+ FixMyStreet::App->send_email_cron(
{
_template_ => $template,
_parameters_ => $h,
@@ -505,7 +508,6 @@ sub _send_report_sent_email {
From => mySociety::Config::get('CONTACT_EMAIL'),
},
mySociety::Config::get('CONTACT_EMAIL'),
- [ $row->user->email ],
$nomail,
$cobrand
);
diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
index b7af9e60e..63a91697d 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
@@ -5,7 +5,6 @@ use strict;
use warnings;
use Encode;
use Utils;
-use mySociety::EmailUtil;
sub send_questionnaires {
my ( $rs, $params ) = @_;
@@ -93,8 +92,6 @@ sub send_questionnaires_period {
. $row->user->email . "\n"
if $params->{verbose};
- $h{site_name} = $cobrand->site_title();
-
my $result = FixMyStreet::App->send_email_cron(
{
_template_ => $template,
@@ -103,11 +100,10 @@ sub send_questionnaires_period {
From => [ $sender, $sender_name ],
},
$sender,
- [ $row->user->email ],
$params->{nomail},
$cobrand
);
- if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) {
+ unless ($result) {
print " ...success\n" if $params->{verbose};
$row->update();
$token->insert();