diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2015-08-12 12:54:06 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2015-08-12 12:54:06 +0000 |
commit | 918a412fd4c807eacfb9986cd13d76b5e7978077 (patch) | |
tree | 10bd8e77921dd6aec767867e3bd5c3eb1bd41328 /app/models/mail_handler.rb | |
parent | 039c333cec7588ec186b8b15ad570d4c62ce3d95 (diff) | |
download | redmine-918a412fd4c807eacfb9986cd13d76b5e7978077.tar.gz redmine-918a412fd4c807eacfb9986cd13d76b5e7978077.zip |
use String#casecmp for case insensitive comparison (#20369)
Contributed by Go MAEDA.
git-svn-id: http://svn.redmine.org/redmine/trunk@14484 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r-- | app/models/mail_handler.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 0696216b1..269b0c4fa 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -92,7 +92,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.downcase == Setting.mail_from.to_s.strip.downcase + 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 @@ -547,18 +547,19 @@ class MailHandler < ActionMailer::Base assignable = issue.assignable_users assignee = nil assignee ||= assignable.detect {|a| - a.mail.to_s.downcase == keyword || - a.login.to_s.downcase == keyword + keyword.casecmp(a.mail.to_s) == 0 || + keyword.casecmp(a.login.to_s) == 0 } if assignee.nil? && keyword.match(/ /) firstname, lastname = *(keyword.split) # "First Last Throwaway" assignee ||= assignable.detect {|a| - a.is_a?(User) && a.firstname.to_s.downcase == firstname && - a.lastname.to_s.downcase == lastname + a.is_a?(User) && + firstname.casecmp(a.firstname.to_s) == 0 && + lastname.casecmp(a.lastname.to_s) == 0 } end if assignee.nil? - assignee ||= assignable.detect {|a| a.name.downcase == keyword} + assignee ||= assignable.detect {|a| keyword.casecmp(a.name) == 0} end assignee end |