summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-17 09:08:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-17 09:08:18 +0000
commit1ccdf38fdde16421905f8419bb83f0e923bd16bc (patch)
treeeee2033d7563c5398692a45a7a16f987bdd552fd /app
parentaf3c91d02aff6593de4847390df59795597bb181 (diff)
downloadredmine-1ccdf38fdde16421905f8419bb83f0e923bd16bc.tar.gz
redmine-1ccdf38fdde16421905f8419bb83f0e923bd16bc.zip
Mail Handler: add support for allow_override=all (#20543).
git-svn-id: http://svn.redmine.org/redmine/trunk@14681 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/mail_handler.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 007df6f2d..1364fdb97 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -29,11 +29,11 @@ class MailHandler < ActionMailer::Base
options[:issue] ||= {}
+ options[:allow_override] ||= []
if options[:allow_override].is_a?(String)
- options[:allow_override] = options[:allow_override].split(',').collect(&:strip)
+ options[:allow_override] = options[:allow_override].split(',')
end
- options[:allow_override] ||= []
- options[:allow_override].map!(&:downcase)
+ options[:allow_override].map! {|s| s.strip.downcase.gsub(/\s+/, '_')}
# Project needs to be overridable if not specified
options[:allow_override] << 'project' unless options[:issue].has_key?(:project)
@@ -327,8 +327,11 @@ class MailHandler < ActionMailer::Base
@keywords[attr]
else
@keywords[attr] = begin
- if (options[:override] || handler_options[:allow_override].include?(attr.to_s.downcase)) &&
- (v = extract_keyword!(cleaned_up_text_body, attr, options[:format]))
+ override = options.key?(:override) ?
+ options[:override] :
+ (handler_options[:allow_override] & [attr.to_s.downcase.gsub(/\s+/, '_'), 'all']).present?
+
+ if override && (v = extract_keyword!(cleaned_up_text_body, attr, options[:format]))
v
elsif !handler_options[:issue][attr].blank?
handler_options[:issue][attr]