aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2013-01-02 12:52:26 +0000
committerMatthew Somerville <matthew@mysociety.org>2013-01-02 12:52:30 +0000
commit16e4d3b007585a1084455b09e9ad6d7048eb5c2a (patch)
treed770d106a55847df80a6bcf70293bb9c26f13a4e
parent2db12c53190fb29666a5cf49514c0f0422ebbbfe (diff)
Add do-not-reply config variable, removing special case from code.
-rw-r--r--.travis.yml1
-rwxr-xr-xbin/install-as-user1
-rw-r--r--conf/general.yml-example4
-rw-r--r--perllib/FixMyStreet/App.pm3
-rw-r--r--perllib/FixMyStreet/App/Controller/Contact.pm4
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm4
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm5
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm3
-rw-r--r--perllib/FixMyStreet/EmailSend.pm5
10 files changed, 14 insertions, 18 deletions
diff --git a/.travis.yml b/.travis.yml
index dcf35ab60..542ffd816 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,7 +33,6 @@ before_script:
-e "s,cobrand_two: 'hostname_substring2',fixmystreet: 'localhost',"
-e "s,(BASE_URL:) 'http://www.example.org',\\1 'http://localhost',"
-e "s,(MAPIT_URL:) '',\\1 'http://mapit.mysociety.org/',"
- -e "s,(CONTACT_EMAIL:) 'team,\\1 'person,"
conf/general.yml-example > conf/general.yml
- ./bin/cron-wrapper ./bin/make_po FixMyStreet-EmptyHomes
- ./bin/cron-wrapper ./bin/make_emptyhomes_welsh_po
diff --git a/bin/install-as-user b/bin/install-as-user
index 2656195f4..2e0816966 100755
--- a/bin/install-as-user
+++ b/bin/install-as-user
@@ -86,6 +86,7 @@ sed -r \
-e "s,^( *BASE_URL:).*,\\1 'http://$HOST'," \
-e "s,^( *EMAIL_DOMAIN:).*,\\1 '$HOST'," \
-e "s,^( *CONTACT_EMAIL:).*,\\1 'help@$HOST'," \
+ -e "s,^( *DO_NOT_REPLY_EMAIL:).*,\\1 'help@$HOST'," \
conf/general.yml-example > conf/general.yml
# Create the database if it doesn't exist:
diff --git a/conf/general.yml-example b/conf/general.yml-example
index 4fbf43635..a8da589d1 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -22,6 +22,10 @@ BASE_URL: 'http://www.example.org'
EMAIL_DOMAIN: 'example.org'
CONTACT_EMAIL: 'team@example.org'
CONTACT_NAME: 'FixMyStreet'
+# Address used for emails you don't expect a reply to (e.g. confirmation
+# emails); can be same as CONTACT_EMAIL above, of course, if you don't have a
+# special address.
+DO_NOT_REPLY_EMAIL: 'do-not-reply@example.org'
# Whether this is a development site or not.
STAGING_SITE: 1
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index fda9d665c..9c7aba9e5 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -274,9 +274,8 @@ sub send_email {
my $template = shift;
my $extra_stash_values = shift || {};
- my $sender = $c->cobrand->contact_email;
+ my $sender = $c->config->{DO_NOT_REPLY_EMAIL};
my $sender_name = $c->cobrand->contact_name;
- $sender =~ s/team/fms-DO-NOT-REPLY/;
# create the vars to pass to the email template
my $vars = {
diff --git a/perllib/FixMyStreet/App/Controller/Contact.pm b/perllib/FixMyStreet/App/Controller/Contact.pm
index 926a3f2a5..c8b0c2046 100644
--- a/perllib/FixMyStreet/App/Controller/Contact.pm
+++ b/perllib/FixMyStreet/App/Controller/Contact.pm
@@ -184,7 +184,7 @@ generally required to stash
sub setup_request : Private {
my ( $self, $c ) = @_;
- $c->stash->{contact_email} = $c->cobrand->contact_email( 'contact' );
+ $c->stash->{contact_email} = $c->cobrand->contact_email;
$c->stash->{contact_email} =~ s/\@/&#64;/;
for my $param (qw/em subject message/) {
@@ -206,7 +206,7 @@ Sends the email
sub send_email : Private {
my ( $self, $c ) = @_;
- my $recipient = $c->cobrand->contact_email( 'contact' );
+ my $recipient = $c->cobrand->contact_email;
my $recipient_name = $c->cobrand->contact_name();
$c->stash->{host} = $c->req->header('HOST');
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index 040b0d3e6..3382c0cea 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -100,7 +100,7 @@ sub error : Private {
sub get_discovery : Private {
my ( $self, $c ) = @_;
- my $contact_email = $c->config->{CONTACT_EMAIL};
+ my $contact_email = $c->cobrand->contact_email;
my $prod_url = 'http://www.fiksgatami.no/open311';
my $test_url = 'http://fiksgatami-dev.nuug.no/open311';
my $prod_changeset = '2011-04-08T00:00:00Z';
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index a4c4f4ffc..0d4894aa8 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -80,9 +80,7 @@ sub process_extras {
sub contact_email {
my $self = shift;
- my $type = shift || '';
- return join( '@', 'info', 'bromley.gov.uk' ) if $type eq 'contact';
- return $self->next::method();
+ return join( '@', 'info', 'bromley.gov.uk' );
}
sub contact_name { 'Bromley Council (do not reply)'; }
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 468df2654..d903f8eb2 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -230,13 +230,12 @@ sub _send_aggregated_alert_email(%) {
unless -e $template;
$template = Utils::read_file($template);
- my $sender = $cobrand->contact_email;
- (my $from = $sender) =~ s/team/fms-DO-NOT-REPLY/; # XXX
+ my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
my $result = FixMyStreet::App->send_email_cron(
{
_template_ => $template,
_parameters_ => \%data,
- From => [ $from, _($cobrand->contact_name) ],
+ From => [ $sender, _($cobrand->contact_name) ],
To => $data{alert_email},
},
$sender,
diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
index d6b3eb5cb..1b9521a9f 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
@@ -89,9 +89,8 @@ sub send_questionnaires_period {
} );
$h{url} = $cobrand->base_url($row->cobrand_data) . '/Q/' . $token->token;
- my $sender = $cobrand->contact_email;
+ my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
my $sender_name = _($cobrand->contact_name);
- $sender =~ s/team/fms-DO-NOT-REPLY/;
print "Sending questionnaire " . $questionnaire->id . ", problem "
. $row->id . ", token " . $token->token . " to "
diff --git a/perllib/FixMyStreet/EmailSend.pm b/perllib/FixMyStreet/EmailSend.pm
index 61d8a70c2..8b6eed462 100644
--- a/perllib/FixMyStreet/EmailSend.pm
+++ b/perllib/FixMyStreet/EmailSend.pm
@@ -2,10 +2,7 @@ package FixMyStreet::EmailSend;
use base Email::Send::SMTP;
sub get_env_sender {
- # Should really use cobrand's contact_email function, but not sure how
- # best to access that from in here.
- my $sender = FixMyStreet->config('CONTACT_EMAIL');
- $sender =~ s/team/fms-DO-NOT-REPLY/;
+ my $sender = FixMyStreet->config('DO_NOT_REPLY_EMAIL');
return $sender;
}