diff --git a/app/models/comment.rb b/app/models/comment.rb index 3275582..4df38ee 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -172,7 +172,7 @@ class Comment < ActiveRecord::Base def mail(comment) profile = comment.article.profile recipients comment.notification_emails - from "#{profile.environment.name} <#{profile.environment.contact_email}>" + from "#{profile.environment.name} <#{profile.environment.noreply_email}>" subject _("[%s] you got a new comment!") % [profile.environment.name] body :recipient => profile.nickname || profile.name, :sender => comment.author_name, @@ -187,7 +187,7 @@ class Comment < ActiveRecord::Base def mail_to_followers(comment, emails) profile = comment.article.profile bcc emails - from "#{profile.environment.name} <#{profile.environment.contact_email}>" + from "#{profile.environment.name} <#{profile.environment.noreply_email}>" subject _("[%s] %s commented on a content of %s") % [profile.environment.name, comment.author_name, profile.short_name] body :recipient => profile.nickname || profile.name, :sender => comment.author_name, diff --git a/app/models/contact.rb b/app/models/contact.rb index 459b7a8..ef40ec5 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -26,7 +26,7 @@ class Contact < ActiveRecord::Base #WithoutTable content_type 'text/html' emails = contact.dest.notification_emails recipients emails - from "#{contact.name} <#{contact.dest.environment.contact_email}>" + from "#{contact.name} <#{contact.dest.environment.noreply_email}>" reply_to contact.email if contact.sender headers 'X-Noosfero-Sender' => contact.sender.identifier diff --git a/app/models/environment.rb b/app/models/environment.rb index aeb9ec1..35f060d 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -764,7 +764,7 @@ class Environment < ActiveRecord::Base end def notification_emails - [contact_email.blank? ? nil : contact_email].compact + admins.map(&:email) + [noreply_email.blank? ? nil : noreply_email].compact + admins.map(&:email) end after_create :create_templates diff --git a/app/models/mailing.rb b/app/models/mailing.rb index 2ad69d1..a304263 100644 --- a/app/models/mailing.rb +++ b/app/models/mailing.rb @@ -17,7 +17,7 @@ class Mailing < ActiveRecord::Base end def generate_from - "#{source.name} <#{source.contact_email}>" + "#{source.name} <#{if source.is_a? Environment then source.noreply_email else source.contact_email end}>" end def generate_subject diff --git a/app/models/organization_mailing.rb b/app/models/organization_mailing.rb index ddd9fb3..c31b9a2 100644 --- a/app/models/organization_mailing.rb +++ b/app/models/organization_mailing.rb @@ -1,7 +1,7 @@ class OrganizationMailing < Mailing def generate_from - "#{person.name} <#{source.environment.contact_email}>" + "#{person.name} <#{source.environment.noreply_email}>" end def recipients(offset=0, limit=100) diff --git a/app/models/pending_task_notifier.rb b/app/models/pending_task_notifier.rb index 478b145..fe7c465 100644 --- a/app/models/pending_task_notifier.rb +++ b/app/models/pending_task_notifier.rb @@ -2,7 +2,7 @@ class PendingTaskNotifier < ActionMailer::Base def notification(person) recipients person.email - from "#{person.environment.name} <#{person.environment.contact_email}>" + from "#{person.environment.name} <#{person.environment.noreply_email}>" subject _("[%s] Pending tasks") % person.environment.name body :person => person, :tasks => person.tasks.pending, diff --git a/app/models/scrap.rb b/app/models/scrap.rb index c224a3e..745c60a 100644 --- a/app/models/scrap.rb +++ b/app/models/scrap.rb @@ -14,7 +14,7 @@ class Scrap < ActiveRecord::Base named_scope :not_replies, :conditions => {:scrap_id => nil} - track_actions :leave_scrap, :after_create, :keep_params => ['sender.name', 'content', 'receiver.name', 'receiver.url'], :if => Proc.new{|s| s.sender != s.receiver && s.sender != s.top_root.receiver}, :custom_target => :action_tracker_target + track_actions :leave_scrap, :after_create, :keep_params => ['sender.name', 'content', 'receiver.name', 'receiver.url'], :if => Proc.new{|s| s.sender != s.receiver && s.sender != s.top_root.receiver}, :custom_target => :action_tracker_target track_actions :leave_scrap_to_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender == s.receiver} @@ -59,7 +59,7 @@ class Scrap < ActiveRecord::Base sender, receiver = scrap.sender, scrap.receiver recipients receiver.email - from "#{sender.environment.name} <#{sender.environment.contact_email}>" + from "#{sender.environment.name} <#{sender.environment.noreply_email}>" subject _("[%s] You received a scrap!") % [sender.environment.name] body :recipient => receiver.name, :sender => sender.name, diff --git a/app/models/task_mailer.rb b/app/models/task_mailer.rb index ba298ef..4e26c3e 100644 --- a/app/models/task_mailer.rb +++ b/app/models/task_mailer.rb @@ -60,7 +60,7 @@ class TaskMailer < ActionMailer::Base end def self.generate_from(task) - "#{task.environment.name} <#{task.environment.contact_email}>" + "#{task.environment.name} <#{task.environment.noreply_email}>" end def generate_environment_url(task, url = {}) diff --git a/app/models/user.rb b/app/models/user.rb index af6de5b..f6ac4fc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -54,7 +54,7 @@ class User < ActiveRecord::Base def activation_email_notify(user) user_email = "#{user.login}@#{user.email_domain}" recipients user_email - from "#{user.environment.name} <#{user.environment.contact_email}>" + from "#{user.environment.name} <#{user.environment.noreply_email}>" subject _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } body :name => user.name, :email => user_email, @@ -66,7 +66,7 @@ class User < ActiveRecord::Base def activation_code(user) recipients user.email - from "#{user.environment.name} <#{user.environment.contact_email}>" + from "#{user.environment.name} <#{user.environment.noreply_email}>" subject _("[%s] Activate your account") % [user.environment.name] body :recipient => user.name, :activation_code => user.activation_code, @@ -81,7 +81,7 @@ class User < ActiveRecord::Base content_type 'text/html' recipients user.email - from "#{user.environment.name} <#{user.environment.contact_email}>" + from "#{user.environment.name} <#{user.environment.noreply_email}>" subject email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject body email_body end @@ -93,7 +93,7 @@ class User < ActiveRecord::Base self.person.save! end end - + has_one :person, :dependent => :destroy belongs_to :environment @@ -183,7 +183,7 @@ class User < ActiveRecord::Base encryption_methods[sym] = block end - # the encryption method used for this instance + # the encryption method used for this instance def encryption_method (password_type || User.system_encryption_method).to_sym end @@ -226,7 +226,7 @@ class User < ActiveRecord::Base end def remember_token? - remember_token_expires_at && Time.now.utc < remember_token_expires_at + remember_token_expires_at && Time.now.utc < remember_token_expires_at end # These create and unset the fields required for remembering users between browser closes @@ -255,7 +255,7 @@ class User < ActiveRecord::Base raise IncorrectPassword unless self.authenticated?(current) self.force_change_password!(new, confirmation) end - + # Changes the password of a user without asking for the old password. This # method is intended to be used by the "I forgot my password", and must be # used with care. @@ -326,7 +326,7 @@ class User < ActiveRecord::Base end protected - # before filter + # before filter def encrypt_password return if password.blank? self.salt ||= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record? diff --git a/app/views/admin_panel/_site_info.rhtml b/app/views/admin_panel/_site_info.rhtml index e2cf95a..062b062 100644 --- a/app/views/admin_panel/_site_info.rhtml +++ b/app/views/admin_panel/_site_info.rhtml @@ -1,5 +1,6 @@ <%= required labelled_form_field(_('Site name'), text_field(:environment, :name)) %> <%= labelled_form_field(_('Contact email'), text_field(:environment, :contact_email)) %> +<%= labelled_form_field(_('No reply email'), text_field(:environment, :noreply_email)) %> <% themes_options = Theme.system_themes.map {|theme| [theme.name, theme.id] }.sort %> <%= labelled_form_field(_('Theme'), select(:environment, :theme, options_for_select(themes_options, environment.theme))) %> <%= required f.text_field(:reports_lower_bound, :size => 3) %> diff --git a/lib/feed_updater.rb b/lib/feed_updater.rb index fc080f1..6c99450 100644 --- a/lib/feed_updater.rb +++ b/lib/feed_updater.rb @@ -24,8 +24,8 @@ class FeedUpdater environment = Environment.default recipients NOOSFERO_CONF['exception_recipients'] - from environment.contact_email - reply_to environment.contact_email + from environment.noreply_email + reply_to environment.noreply_email subject "[#{environment.name}] Feed-updater: #{error.message}" body render(:text => " Container: diff --git a/plugins/send_email/controllers/send_email_plugin_base_controller.rb b/plugins/send_email/controllers/send_email_plugin_base_controller.rb index 06ace29..438eba4 100644 --- a/plugins/send_email/controllers/send_email_plugin_base_controller.rb +++ b/plugins/send_email/controllers/send_email_plugin_base_controller.rb @@ -3,7 +3,7 @@ module SendEmailPluginBaseController if request.post? @context_url = profile ? profile.url : {:host => environment.default_hostname, :controller => 'home'} @mail = SendEmailPlugin::Mail.new( - :from => environment.contact_email, + :from => environment.noreply_email, :to => params[:to], :message => params[:message], :environment => environment, diff --git a/plugins/spaminator/lib/spaminator_plugin/mailer.rb b/plugins/spaminator/lib/spaminator_plugin/mailer.rb index 1bd90db..d0747ab 100644 --- a/plugins/spaminator/lib/spaminator_plugin/mailer.rb +++ b/plugins/spaminator/lib/spaminator_plugin/mailer.rb @@ -2,7 +2,7 @@ class SpaminatorPlugin::Mailer < Noosfero::Plugin::MailerBase def inactive_person_notification(person) recipients person.email - from "#{person.environment.name} <#{person.environment.contact_email}>" + from "#{person.environment.name} <#{person.environment.noreply_email}>" subject _("[%s] You must reactivate your account.") % person.environment.name content_type 'text/html' body :person => person, diff --git a/plugins/spaminator/test/unit/spaminator_plugin/mailer_test.rb b/plugins/spaminator/test/unit/spaminator_plugin/mailer_test.rb index 1778524..34d5373 100644 --- a/plugins/spaminator/test/unit/spaminator_plugin/mailer_test.rb +++ b/plugins/spaminator/test/unit/spaminator_plugin/mailer_test.rb @@ -14,7 +14,7 @@ class SpaminatorPlugin::MailerTest < ActiveSupport::TestCase attr_accessor :environment, :settings should 'be able to send a inactive person notification message' do - environment.contact_email = 'no-reply@noosfero.org' + environment.noreply_email = 'no-reply@noosfero.org' environment.save person = create_user('spammer').person diff --git a/test/unit/contact_sender_test.rb b/test/unit/contact_sender_test.rb index d4c65f9..29ce03b 100644 --- a/test/unit/contact_sender_test.rb +++ b/test/unit/contact_sender_test.rb @@ -16,7 +16,7 @@ class ContactSenderTest < ActiveSupport::TestCase ent.contact_email = 'contact@invalid.com' c = build(Contact, :dest => ent) response = Contact::Sender.deliver_mail(c) - assert_equal Environment.default.contact_email, response.from.to_s + assert_equal Environment.default.noreply_email, response.from.to_s assert_equal "[#{ent.name}] #{c.subject}", response.subject end @@ -27,7 +27,7 @@ class ContactSenderTest < ActiveSupport::TestCase response = Contact::Sender.deliver_mail(c) assert_includes response.to, c.dest.contact_email end - + should 'deliver mail to admins of enterprise' do admin = create_user('admin_test').person ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) diff --git a/test/unit/contact_test.rb b/test/unit/contact_test.rb index bdb0753..aaf8d44 100644 --- a/test/unit/contact_test.rb +++ b/test/unit/contact_test.rb @@ -44,11 +44,11 @@ class ContactTest < ActiveSupport::TestCase assert !c.deliver end - should 'use sender name and environment contact_email on from' do + should 'use sender name and environment noreply_email on from' do ent = fast_create(Enterprise, :name => 'my enterprise', :identifier => 'myent') c = Contact.new(:name => 'john', :email => 'john@invalid.com', :subject => 'hi', :message => 'hi, all', :dest => ent) email = c.deliver - assert_equal "#{c.name} <#{ent.environment.contact_email}>", email['from'].to_s + assert_equal "#{c.name} <#{ent.environment.noreply_email}>", email['from'].to_s end should 'add dest name on subject' do diff --git a/test/unit/environment_mailing_test.rb b/test/unit/environment_mailing_test.rb index 488f7bc..e2d5571 100644 --- a/test/unit/environment_mailing_test.rb +++ b/test/unit/environment_mailing_test.rb @@ -46,7 +46,7 @@ class EnvironmentMailingTest < ActiveSupport::TestCase should 'display name and email on generate_from' do mailing = EnvironmentMailing.new(:source => environment, :person => person_1) - assert_equal "#{environment.name} <#{environment.contact_email}>", mailing.generate_from + assert_equal "#{environment.name} <#{environment.noreply_email}>", mailing.generate_from end should 'deliver mailing to each recipient after create' do diff --git a/test/unit/mailing_test.rb b/test/unit/mailing_test.rb index 331e28f..aee4462 100644 --- a/test/unit/mailing_test.rb +++ b/test/unit/mailing_test.rb @@ -74,7 +74,7 @@ class MailingTest < ActiveSupport::TestCase should 'display name and email on generate_from' do person = Person['user_one'] mailing = Mailing.new(:source => environment, :person => person) - assert_equal "#{environment.name} <#{environment.contact_email}>", mailing.generate_from + assert_equal "#{environment.name} <#{environment.noreply_email}>", mailing.generate_from end should 'generate subject' do diff --git a/test/unit/organization_mailing_test.rb b/test/unit/organization_mailing_test.rb index 33ad4b0..26651b8 100644 --- a/test/unit/organization_mailing_test.rb +++ b/test/unit/organization_mailing_test.rb @@ -42,7 +42,7 @@ class OrganizationMailingTest < ActiveSupport::TestCase should 'display name and email on generate_from' do mailing = OrganizationMailing.new(:source => community, :person => person) - assert_equal "#{person.name} <#{community.environment.contact_email}>", mailing.generate_from + assert_equal "#{person.name} <#{community.environment.noreply_email}>", mailing.generate_from end should 'generate subject' do diff --git a/vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb b/vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb index 7c0a43d..7ca59f5 100644 --- a/vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb +++ b/vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb @@ -5,8 +5,8 @@ Delayed::Worker.module_eval do environment = Environment.default recipients NOOSFERO_CONF['exception_recipients'] - from environment.contact_email - reply_to environment.contact_email + from environment.noreply_email + reply_to environment.noreply_email subject "[#{environment.name}] DelayedJob ##{job.id}: #{error.message}" body render(:text => " Job: -- libgit2 0.21.2