summaryrefslogtreecommitdiffstats
path: root/app/models/setting.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-02-12 23:35:05 +0000
committerGo MAEDA <maeda@farend.jp>2019-02-12 23:35:05 +0000
commitb0b8978ff84ef25dfa8efa842a8643377bbbe266 (patch)
tree15bc5e6a240d8bc1dc2d68e76fb30d2ab8563adb /app/models/setting.rb
parent58ea5b9d537234236c3fd95aaec6350658e75499 (diff)
downloadredmine-b0b8978ff84ef25dfa8efa842a8643377bbbe266.tar.gz
redmine-b0b8978ff84ef25dfa8efa842a8643377bbbe266.zip
Fix: Mail handler does not ignore emails sent from emission email address if Setting.mail_from includes display name (#30785).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@17862 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/setting.rb')
-rw-r--r--app/models/setting.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb
index e59c48c86..e6de85906 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -228,6 +228,12 @@ 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