Commit 0497c66290229ae2dd918e24da96649e52f59652
1 parent
d96fa2ea
Exists in
master
and in
29 other branches
Rename contact_email with noreply_email when pertinent
Showing
20 changed files
with
33 additions
and
32 deletions
Show diff stats
app/models/comment.rb
@@ -172,7 +172,7 @@ class Comment < ActiveRecord::Base | @@ -172,7 +172,7 @@ class Comment < ActiveRecord::Base | ||
172 | def mail(comment) | 172 | def mail(comment) |
173 | profile = comment.article.profile | 173 | profile = comment.article.profile |
174 | recipients comment.notification_emails | 174 | recipients comment.notification_emails |
175 | - from "#{profile.environment.name} <#{profile.environment.contact_email}>" | 175 | + from "#{profile.environment.name} <#{profile.environment.noreply_email}>" |
176 | subject _("[%s] you got a new comment!") % [profile.environment.name] | 176 | subject _("[%s] you got a new comment!") % [profile.environment.name] |
177 | body :recipient => profile.nickname || profile.name, | 177 | body :recipient => profile.nickname || profile.name, |
178 | :sender => comment.author_name, | 178 | :sender => comment.author_name, |
@@ -187,7 +187,7 @@ class Comment < ActiveRecord::Base | @@ -187,7 +187,7 @@ class Comment < ActiveRecord::Base | ||
187 | def mail_to_followers(comment, emails) | 187 | def mail_to_followers(comment, emails) |
188 | profile = comment.article.profile | 188 | profile = comment.article.profile |
189 | bcc emails | 189 | bcc emails |
190 | - from "#{profile.environment.name} <#{profile.environment.contact_email}>" | 190 | + from "#{profile.environment.name} <#{profile.environment.noreply_email}>" |
191 | subject _("[%s] %s commented on a content of %s") % [profile.environment.name, comment.author_name, profile.short_name] | 191 | subject _("[%s] %s commented on a content of %s") % [profile.environment.name, comment.author_name, profile.short_name] |
192 | body :recipient => profile.nickname || profile.name, | 192 | body :recipient => profile.nickname || profile.name, |
193 | :sender => comment.author_name, | 193 | :sender => comment.author_name, |
app/models/contact.rb
@@ -26,7 +26,7 @@ class Contact < ActiveRecord::Base #WithoutTable | @@ -26,7 +26,7 @@ class Contact < ActiveRecord::Base #WithoutTable | ||
26 | content_type 'text/html' | 26 | content_type 'text/html' |
27 | emails = contact.dest.notification_emails | 27 | emails = contact.dest.notification_emails |
28 | recipients emails | 28 | recipients emails |
29 | - from "#{contact.name} <#{contact.dest.environment.contact_email}>" | 29 | + from "#{contact.name} <#{contact.dest.environment.noreply_email}>" |
30 | reply_to contact.email | 30 | reply_to contact.email |
31 | if contact.sender | 31 | if contact.sender |
32 | headers 'X-Noosfero-Sender' => contact.sender.identifier | 32 | headers 'X-Noosfero-Sender' => contact.sender.identifier |
app/models/environment.rb
@@ -764,7 +764,7 @@ class Environment < ActiveRecord::Base | @@ -764,7 +764,7 @@ class Environment < ActiveRecord::Base | ||
764 | end | 764 | end |
765 | 765 | ||
766 | def notification_emails | 766 | def notification_emails |
767 | - [contact_email.blank? ? nil : contact_email].compact + admins.map(&:email) | 767 | + [noreply_email.blank? ? nil : noreply_email].compact + admins.map(&:email) |
768 | end | 768 | end |
769 | 769 | ||
770 | after_create :create_templates | 770 | after_create :create_templates |
app/models/mailing.rb
@@ -17,7 +17,7 @@ class Mailing < ActiveRecord::Base | @@ -17,7 +17,7 @@ class Mailing < ActiveRecord::Base | ||
17 | end | 17 | end |
18 | 18 | ||
19 | def generate_from | 19 | def generate_from |
20 | - "#{source.name} <#{source.contact_email}>" | 20 | + "#{source.name} <#{if source.is_a? Environment then source.noreply_email else source.contact_email end}>" |
21 | end | 21 | end |
22 | 22 | ||
23 | def generate_subject | 23 | def generate_subject |
app/models/organization_mailing.rb
1 | class OrganizationMailing < Mailing | 1 | class OrganizationMailing < Mailing |
2 | 2 | ||
3 | def generate_from | 3 | def generate_from |
4 | - "#{person.name} <#{source.environment.contact_email}>" | 4 | + "#{person.name} <#{source.environment.noreply_email}>" |
5 | end | 5 | end |
6 | 6 | ||
7 | def recipients(offset=0, limit=100) | 7 | def recipients(offset=0, limit=100) |
app/models/pending_task_notifier.rb
@@ -2,7 +2,7 @@ class PendingTaskNotifier < ActionMailer::Base | @@ -2,7 +2,7 @@ class PendingTaskNotifier < ActionMailer::Base | ||
2 | 2 | ||
3 | def notification(person) | 3 | def notification(person) |
4 | recipients person.email | 4 | recipients person.email |
5 | - from "#{person.environment.name} <#{person.environment.contact_email}>" | 5 | + from "#{person.environment.name} <#{person.environment.noreply_email}>" |
6 | subject _("[%s] Pending tasks") % person.environment.name | 6 | subject _("[%s] Pending tasks") % person.environment.name |
7 | body :person => person, | 7 | body :person => person, |
8 | :tasks => person.tasks.pending, | 8 | :tasks => person.tasks.pending, |
app/models/scrap.rb
@@ -14,7 +14,7 @@ class Scrap < ActiveRecord::Base | @@ -14,7 +14,7 @@ class Scrap < ActiveRecord::Base | ||
14 | 14 | ||
15 | named_scope :not_replies, :conditions => {:scrap_id => nil} | 15 | named_scope :not_replies, :conditions => {:scrap_id => nil} |
16 | 16 | ||
17 | - 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 | 17 | + 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 |
18 | 18 | ||
19 | track_actions :leave_scrap_to_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender == s.receiver} | 19 | track_actions :leave_scrap_to_self, :after_create, :keep_params => ['sender.name', 'content'], :if => Proc.new{|s| s.sender == s.receiver} |
20 | 20 | ||
@@ -59,7 +59,7 @@ class Scrap < ActiveRecord::Base | @@ -59,7 +59,7 @@ class Scrap < ActiveRecord::Base | ||
59 | sender, receiver = scrap.sender, scrap.receiver | 59 | sender, receiver = scrap.sender, scrap.receiver |
60 | recipients receiver.email | 60 | recipients receiver.email |
61 | 61 | ||
62 | - from "#{sender.environment.name} <#{sender.environment.contact_email}>" | 62 | + from "#{sender.environment.name} <#{sender.environment.noreply_email}>" |
63 | subject _("[%s] You received a scrap!") % [sender.environment.name] | 63 | subject _("[%s] You received a scrap!") % [sender.environment.name] |
64 | body :recipient => receiver.name, | 64 | body :recipient => receiver.name, |
65 | :sender => sender.name, | 65 | :sender => sender.name, |
app/models/task_mailer.rb
@@ -60,7 +60,7 @@ class TaskMailer < ActionMailer::Base | @@ -60,7 +60,7 @@ class TaskMailer < ActionMailer::Base | ||
60 | end | 60 | end |
61 | 61 | ||
62 | def self.generate_from(task) | 62 | def self.generate_from(task) |
63 | - "#{task.environment.name} <#{task.environment.contact_email}>" | 63 | + "#{task.environment.name} <#{task.environment.noreply_email}>" |
64 | end | 64 | end |
65 | 65 | ||
66 | def generate_environment_url(task, url = {}) | 66 | def generate_environment_url(task, url = {}) |
app/models/user.rb
@@ -54,7 +54,7 @@ class User < ActiveRecord::Base | @@ -54,7 +54,7 @@ class User < ActiveRecord::Base | ||
54 | def activation_email_notify(user) | 54 | def activation_email_notify(user) |
55 | user_email = "#{user.login}@#{user.email_domain}" | 55 | user_email = "#{user.login}@#{user.email_domain}" |
56 | recipients user_email | 56 | recipients user_email |
57 | - from "#{user.environment.name} <#{user.environment.contact_email}>" | 57 | + from "#{user.environment.name} <#{user.environment.noreply_email}>" |
58 | subject _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } | 58 | subject _("[%{environment}] Welcome to %{environment} mail!") % { :environment => user.environment.name } |
59 | body :name => user.name, | 59 | body :name => user.name, |
60 | :email => user_email, | 60 | :email => user_email, |
@@ -66,7 +66,7 @@ class User < ActiveRecord::Base | @@ -66,7 +66,7 @@ class User < ActiveRecord::Base | ||
66 | def activation_code(user) | 66 | def activation_code(user) |
67 | recipients user.email | 67 | recipients user.email |
68 | 68 | ||
69 | - from "#{user.environment.name} <#{user.environment.contact_email}>" | 69 | + from "#{user.environment.name} <#{user.environment.noreply_email}>" |
70 | subject _("[%s] Activate your account") % [user.environment.name] | 70 | subject _("[%s] Activate your account") % [user.environment.name] |
71 | body :recipient => user.name, | 71 | body :recipient => user.name, |
72 | :activation_code => user.activation_code, | 72 | :activation_code => user.activation_code, |
@@ -81,7 +81,7 @@ class User < ActiveRecord::Base | @@ -81,7 +81,7 @@ class User < ActiveRecord::Base | ||
81 | content_type 'text/html' | 81 | content_type 'text/html' |
82 | recipients user.email | 82 | recipients user.email |
83 | 83 | ||
84 | - from "#{user.environment.name} <#{user.environment.contact_email}>" | 84 | + from "#{user.environment.name} <#{user.environment.noreply_email}>" |
85 | subject email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject | 85 | subject email_subject.blank? ? _("Welcome to environment %s") % [user.environment.name] : email_subject |
86 | body email_body | 86 | body email_body |
87 | end | 87 | end |
@@ -93,7 +93,7 @@ class User < ActiveRecord::Base | @@ -93,7 +93,7 @@ class User < ActiveRecord::Base | ||
93 | self.person.save! | 93 | self.person.save! |
94 | end | 94 | end |
95 | end | 95 | end |
96 | - | 96 | + |
97 | has_one :person, :dependent => :destroy | 97 | has_one :person, :dependent => :destroy |
98 | belongs_to :environment | 98 | belongs_to :environment |
99 | 99 | ||
@@ -183,7 +183,7 @@ class User < ActiveRecord::Base | @@ -183,7 +183,7 @@ class User < ActiveRecord::Base | ||
183 | encryption_methods[sym] = block | 183 | encryption_methods[sym] = block |
184 | end | 184 | end |
185 | 185 | ||
186 | - # the encryption method used for this instance | 186 | + # the encryption method used for this instance |
187 | def encryption_method | 187 | def encryption_method |
188 | (password_type || User.system_encryption_method).to_sym | 188 | (password_type || User.system_encryption_method).to_sym |
189 | end | 189 | end |
@@ -226,7 +226,7 @@ class User < ActiveRecord::Base | @@ -226,7 +226,7 @@ class User < ActiveRecord::Base | ||
226 | end | 226 | end |
227 | 227 | ||
228 | def remember_token? | 228 | def remember_token? |
229 | - remember_token_expires_at && Time.now.utc < remember_token_expires_at | 229 | + remember_token_expires_at && Time.now.utc < remember_token_expires_at |
230 | end | 230 | end |
231 | 231 | ||
232 | # These create and unset the fields required for remembering users between browser closes | 232 | # These create and unset the fields required for remembering users between browser closes |
@@ -255,7 +255,7 @@ class User < ActiveRecord::Base | @@ -255,7 +255,7 @@ class User < ActiveRecord::Base | ||
255 | raise IncorrectPassword unless self.authenticated?(current) | 255 | raise IncorrectPassword unless self.authenticated?(current) |
256 | self.force_change_password!(new, confirmation) | 256 | self.force_change_password!(new, confirmation) |
257 | end | 257 | end |
258 | - | 258 | + |
259 | # Changes the password of a user without asking for the old password. This | 259 | # Changes the password of a user without asking for the old password. This |
260 | # method is intended to be used by the "I forgot my password", and must be | 260 | # method is intended to be used by the "I forgot my password", and must be |
261 | # used with care. | 261 | # used with care. |
@@ -326,7 +326,7 @@ class User < ActiveRecord::Base | @@ -326,7 +326,7 @@ class User < ActiveRecord::Base | ||
326 | end | 326 | end |
327 | 327 | ||
328 | protected | 328 | protected |
329 | - # before filter | 329 | + # before filter |
330 | def encrypt_password | 330 | def encrypt_password |
331 | return if password.blank? | 331 | return if password.blank? |
332 | self.salt ||= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record? | 332 | self.salt ||= Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record? |
app/views/admin_panel/_site_info.rhtml
1 | <%= required labelled_form_field(_('Site name'), text_field(:environment, :name)) %> | 1 | <%= required labelled_form_field(_('Site name'), text_field(:environment, :name)) %> |
2 | <%= labelled_form_field(_('Contact email'), text_field(:environment, :contact_email)) %> | 2 | <%= labelled_form_field(_('Contact email'), text_field(:environment, :contact_email)) %> |
3 | +<%= labelled_form_field(_('No reply email'), text_field(:environment, :noreply_email)) %> | ||
3 | <% themes_options = Theme.system_themes.map {|theme| [theme.name, theme.id] }.sort %> | 4 | <% themes_options = Theme.system_themes.map {|theme| [theme.name, theme.id] }.sort %> |
4 | <%= labelled_form_field(_('Theme'), select(:environment, :theme, options_for_select(themes_options, environment.theme))) %> | 5 | <%= labelled_form_field(_('Theme'), select(:environment, :theme, options_for_select(themes_options, environment.theme))) %> |
5 | <%= required f.text_field(:reports_lower_bound, :size => 3) %> | 6 | <%= required f.text_field(:reports_lower_bound, :size => 3) %> |
lib/feed_updater.rb
@@ -24,8 +24,8 @@ class FeedUpdater | @@ -24,8 +24,8 @@ class FeedUpdater | ||
24 | environment = Environment.default | 24 | environment = Environment.default |
25 | 25 | ||
26 | recipients NOOSFERO_CONF['exception_recipients'] | 26 | recipients NOOSFERO_CONF['exception_recipients'] |
27 | - from environment.contact_email | ||
28 | - reply_to environment.contact_email | 27 | + from environment.noreply_email |
28 | + reply_to environment.noreply_email | ||
29 | subject "[#{environment.name}] Feed-updater: #{error.message}" | 29 | subject "[#{environment.name}] Feed-updater: #{error.message}" |
30 | body render(:text => " | 30 | body render(:text => " |
31 | Container: | 31 | Container: |
plugins/send_email/controllers/send_email_plugin_base_controller.rb
@@ -3,7 +3,7 @@ module SendEmailPluginBaseController | @@ -3,7 +3,7 @@ module SendEmailPluginBaseController | ||
3 | if request.post? | 3 | if request.post? |
4 | @context_url = profile ? profile.url : {:host => environment.default_hostname, :controller => 'home'} | 4 | @context_url = profile ? profile.url : {:host => environment.default_hostname, :controller => 'home'} |
5 | @mail = SendEmailPlugin::Mail.new( | 5 | @mail = SendEmailPlugin::Mail.new( |
6 | - :from => environment.contact_email, | 6 | + :from => environment.noreply_email, |
7 | :to => params[:to], | 7 | :to => params[:to], |
8 | :message => params[:message], | 8 | :message => params[:message], |
9 | :environment => environment, | 9 | :environment => environment, |
plugins/spaminator/lib/spaminator_plugin/mailer.rb
@@ -2,7 +2,7 @@ class SpaminatorPlugin::Mailer < Noosfero::Plugin::MailerBase | @@ -2,7 +2,7 @@ class SpaminatorPlugin::Mailer < Noosfero::Plugin::MailerBase | ||
2 | 2 | ||
3 | def inactive_person_notification(person) | 3 | def inactive_person_notification(person) |
4 | recipients person.email | 4 | recipients person.email |
5 | - from "#{person.environment.name} <#{person.environment.contact_email}>" | 5 | + from "#{person.environment.name} <#{person.environment.noreply_email}>" |
6 | subject _("[%s] You must reactivate your account.") % person.environment.name | 6 | subject _("[%s] You must reactivate your account.") % person.environment.name |
7 | content_type 'text/html' | 7 | content_type 'text/html' |
8 | body :person => person, | 8 | body :person => person, |
plugins/spaminator/test/unit/spaminator_plugin/mailer_test.rb
@@ -14,7 +14,7 @@ class SpaminatorPlugin::MailerTest < ActiveSupport::TestCase | @@ -14,7 +14,7 @@ class SpaminatorPlugin::MailerTest < ActiveSupport::TestCase | ||
14 | attr_accessor :environment, :settings | 14 | attr_accessor :environment, :settings |
15 | 15 | ||
16 | should 'be able to send a inactive person notification message' do | 16 | should 'be able to send a inactive person notification message' do |
17 | - environment.contact_email = 'no-reply@noosfero.org' | 17 | + environment.noreply_email = 'no-reply@noosfero.org' |
18 | environment.save | 18 | environment.save |
19 | 19 | ||
20 | person = create_user('spammer').person | 20 | person = create_user('spammer').person |
test/unit/contact_sender_test.rb
@@ -16,7 +16,7 @@ class ContactSenderTest < ActiveSupport::TestCase | @@ -16,7 +16,7 @@ class ContactSenderTest < ActiveSupport::TestCase | ||
16 | ent.contact_email = 'contact@invalid.com' | 16 | ent.contact_email = 'contact@invalid.com' |
17 | c = build(Contact, :dest => ent) | 17 | c = build(Contact, :dest => ent) |
18 | response = Contact::Sender.deliver_mail(c) | 18 | response = Contact::Sender.deliver_mail(c) |
19 | - assert_equal Environment.default.contact_email, response.from.to_s | 19 | + assert_equal Environment.default.noreply_email, response.from.to_s |
20 | assert_equal "[#{ent.name}] #{c.subject}", response.subject | 20 | assert_equal "[#{ent.name}] #{c.subject}", response.subject |
21 | end | 21 | end |
22 | 22 | ||
@@ -27,7 +27,7 @@ class ContactSenderTest < ActiveSupport::TestCase | @@ -27,7 +27,7 @@ class ContactSenderTest < ActiveSupport::TestCase | ||
27 | response = Contact::Sender.deliver_mail(c) | 27 | response = Contact::Sender.deliver_mail(c) |
28 | assert_includes response.to, c.dest.contact_email | 28 | assert_includes response.to, c.dest.contact_email |
29 | end | 29 | end |
30 | - | 30 | + |
31 | should 'deliver mail to admins of enterprise' do | 31 | should 'deliver mail to admins of enterprise' do |
32 | admin = create_user('admin_test').person | 32 | admin = create_user('admin_test').person |
33 | ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) | 33 | ent = Enterprise.create!(:name => 'my enterprise', :identifier => 'myent', :environment => Environment.default) |
test/unit/contact_test.rb
@@ -44,11 +44,11 @@ class ContactTest < ActiveSupport::TestCase | @@ -44,11 +44,11 @@ class ContactTest < ActiveSupport::TestCase | ||
44 | assert !c.deliver | 44 | assert !c.deliver |
45 | end | 45 | end |
46 | 46 | ||
47 | - should 'use sender name and environment contact_email on from' do | 47 | + should 'use sender name and environment noreply_email on from' do |
48 | ent = fast_create(Enterprise, :name => 'my enterprise', :identifier => 'myent') | 48 | ent = fast_create(Enterprise, :name => 'my enterprise', :identifier => 'myent') |
49 | c = Contact.new(:name => 'john', :email => 'john@invalid.com', :subject => 'hi', :message => 'hi, all', :dest => ent) | 49 | c = Contact.new(:name => 'john', :email => 'john@invalid.com', :subject => 'hi', :message => 'hi, all', :dest => ent) |
50 | email = c.deliver | 50 | email = c.deliver |
51 | - assert_equal "#{c.name} <#{ent.environment.contact_email}>", email['from'].to_s | 51 | + assert_equal "#{c.name} <#{ent.environment.noreply_email}>", email['from'].to_s |
52 | end | 52 | end |
53 | 53 | ||
54 | should 'add dest name on subject' do | 54 | should 'add dest name on subject' do |
test/unit/environment_mailing_test.rb
@@ -46,7 +46,7 @@ class EnvironmentMailingTest < ActiveSupport::TestCase | @@ -46,7 +46,7 @@ class EnvironmentMailingTest < ActiveSupport::TestCase | ||
46 | 46 | ||
47 | should 'display name and email on generate_from' do | 47 | should 'display name and email on generate_from' do |
48 | mailing = EnvironmentMailing.new(:source => environment, :person => person_1) | 48 | mailing = EnvironmentMailing.new(:source => environment, :person => person_1) |
49 | - assert_equal "#{environment.name} <#{environment.contact_email}>", mailing.generate_from | 49 | + assert_equal "#{environment.name} <#{environment.noreply_email}>", mailing.generate_from |
50 | end | 50 | end |
51 | 51 | ||
52 | should 'deliver mailing to each recipient after create' do | 52 | should 'deliver mailing to each recipient after create' do |
test/unit/mailing_test.rb
@@ -74,7 +74,7 @@ class MailingTest < ActiveSupport::TestCase | @@ -74,7 +74,7 @@ class MailingTest < ActiveSupport::TestCase | ||
74 | should 'display name and email on generate_from' do | 74 | should 'display name and email on generate_from' do |
75 | person = Person['user_one'] | 75 | person = Person['user_one'] |
76 | mailing = Mailing.new(:source => environment, :person => person) | 76 | mailing = Mailing.new(:source => environment, :person => person) |
77 | - assert_equal "#{environment.name} <#{environment.contact_email}>", mailing.generate_from | 77 | + assert_equal "#{environment.name} <#{environment.noreply_email}>", mailing.generate_from |
78 | end | 78 | end |
79 | 79 | ||
80 | should 'generate subject' do | 80 | should 'generate subject' do |
test/unit/organization_mailing_test.rb
@@ -42,7 +42,7 @@ class OrganizationMailingTest < ActiveSupport::TestCase | @@ -42,7 +42,7 @@ class OrganizationMailingTest < ActiveSupport::TestCase | ||
42 | 42 | ||
43 | should 'display name and email on generate_from' do | 43 | should 'display name and email on generate_from' do |
44 | mailing = OrganizationMailing.new(:source => community, :person => person) | 44 | mailing = OrganizationMailing.new(:source => community, :person => person) |
45 | - assert_equal "#{person.name} <#{community.environment.contact_email}>", mailing.generate_from | 45 | + assert_equal "#{person.name} <#{community.environment.noreply_email}>", mailing.generate_from |
46 | end | 46 | end |
47 | 47 | ||
48 | should 'generate subject' do | 48 | should 'generate subject' do |
vendor/plugins/monkey_patches/rescue_delayed_job_crashes/init.rb
@@ -5,8 +5,8 @@ Delayed::Worker.module_eval do | @@ -5,8 +5,8 @@ Delayed::Worker.module_eval do | ||
5 | environment = Environment.default | 5 | environment = Environment.default |
6 | 6 | ||
7 | recipients NOOSFERO_CONF['exception_recipients'] | 7 | recipients NOOSFERO_CONF['exception_recipients'] |
8 | - from environment.contact_email | ||
9 | - reply_to environment.contact_email | 8 | + from environment.noreply_email |
9 | + reply_to environment.noreply_email | ||
10 | subject "[#{environment.name}] DelayedJob ##{job.id}: #{error.message}" | 10 | subject "[#{environment.name}] DelayedJob ##{job.id}: #{error.message}" |
11 | body render(:text => " | 11 | body render(:text => " |
12 | Job: | 12 | Job: |