summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-02-18 13:03:03 +0000
committerGo MAEDA <maeda@farend.jp>2019-02-18 13:03:03 +0000
commit5329ef3b826d9cb291951abf1b602e48732dddce (patch)
tree512cd4a815924ed04eed02b3c855f30ff3921b8d
parent979b0b6331db287179661594e22539331c1d8fb3 (diff)
downloadredmine-5329ef3b826d9cb291951abf1b602e48732dddce.tar.gz
redmine-5329ef3b826d9cb291951abf1b602e48732dddce.zip
Reverts r17862.
git-svn-id: http://svn.redmine.org/redmine/trunk@17878 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rwxr-xr-xapp/models/mail_handler.rb2
-rw-r--r--app/models/setting.rb6
-rw-r--r--test/unit/setting_test.rb17
3 files changed, 1 insertions, 24 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 6586c52bb..9298e1b12 100755
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -91,7 +91,7 @@ class MailHandler < ActionMailer::Base
@handler_options = options
sender_email = email.from.to_a.first.to_s.strip
# Ignore emails received from the application emission address to avoid hell cycles
- if sender_email.casecmp(Setting.mail_from_address) == 0
+ if sender_email.casecmp(Setting.mail_from.to_s.strip) == 0
if logger
logger.info "MailHandler: ignoring email from Redmine emission address [#{sender_email}]"
end
diff --git a/app/models/setting.rb b/app/models/setting.rb
index e6de85906..e59c48c86 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -228,12 +228,6 @@ class Setting < ActiveRecord::Base
Object.const_defined?(:OpenID) && self[:openid].to_i > 0
end
- # Extracts an email address ("joe@example.com") from
- # Setting.mail_from ("Joe Bloggs <joe@example.com>")
- def self.mail_from_address
- self.mail_from.to_s.gsub(/(?:.*<|>.*|\(.*\))/, '').strip
- end
-
# Checks if settings have changed since the values were read
# and clears the cache hash if it's the case
# Called once per request
diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb
index 710d9581e..5eed249f1 100644
--- a/test/unit/setting_test.rb
+++ b/test/unit/setting_test.rb
@@ -112,23 +112,6 @@ class SettingTest < ActiveSupport::TestCase
end
end
- def test_mail_from_address
- mail_from_strings = [
- 'joe@example.com',
- '<joe@example.com>',
- 'Joe Bloggs <joe@example.com>',
- 'display_name@example.com <joe@example.com>',
- 'joe@example.com (Joe Bloggs)',
- 'joe@example.com (display_name@example.com)'
- ]
-
- mail_from_strings.each do |from_value|
- with_settings :mail_from => from_value do
- assert_equal 'joe@example.com', Setting.mail_from_address
- end
- end
- end
-
def test_setting_serialied_as_binary_should_be_loaded_as_utf8_encoded_strings
yaml = <<-YAML
---