Commit faeba294e907bb66a0b7774dabbbe6ce0eff81f5

Authored by Antonio Terceiro
1 parent bbfaed44

Environment: use contact_email for notifications

There is no point at all in send email to the noreply_email
app/models/environment.rb
... ... @@ -804,7 +804,7 @@ class Environment < ActiveRecord::Base
804 804 end
805 805  
806 806 def notification_emails
807   - [noreply_email.blank? ? nil : noreply_email].compact + admins.map(&:email)
  807 + [contact_email].select(&:present?) + admins.map(&:email)
808 808 end
809 809  
810 810 after_create :create_templates
... ...
test/unit/environment_test.rb
... ... @@ -195,6 +195,12 @@ class EnvironmentTest < ActiveSupport::TestCase
195 195 assert !env.errors[:contact_email.to_s].present?
196 196 end
197 197  
  198 + should 'notify contact email' do
  199 + env = Environment.new(:contact_email => 'foo@bar.com')
  200 + env.stubs(:admins).returns([])
  201 + assert_equal ['foo@bar.com'], env.notification_emails
  202 + end
  203 +
198 204 should 'provide a default hostname' do
199 205 env = fast_create(Environment)
200 206 env.domains << create(Domain, :name => 'example.com', :is_default => true)
... ...