From 7bcb299a3c8ad2a1ae3778482db954556d8417c0 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 8 Nov 2019 14:53:11 +0000 Subject: [PATCH] cleanup: rubocop: fix Style/MultilineTernaryOperator in app/models/mail_handler.rb git-svn-id: http://svn.redmine.org/redmine/trunk@18960 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .rubocop_todo.yml | 1 - app/models/mail_handler.rb | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4eed44a24..78e4b84ab 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1246,7 +1246,6 @@ Style/MultilineTernaryOperator: - 'app/helpers/settings_helper.rb' - 'app/models/issue_query.rb' - 'app/models/issue_relation.rb' - - 'app/models/mail_handler.rb' - 'lib/redmine/ciphering.rb' - 'lib/redmine/scm/adapters/filesystem_adapter.rb' - 'lib/redmine/scm/adapters/git_adapter.rb' diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index 7f03591e2..eccc93a2a 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -344,10 +344,12 @@ class MailHandler < ActionMailer::Base @keywords[attr] else @keywords[attr] = begin - override = options.key?(:override) ? - options[:override] : - (handler_options[:allow_override] & [attr.to_s.downcase.gsub(/\s+/, '_'), 'all']).present? - + override = + if options.key?(:override) + options[:override] + else + (handler_options[:allow_override] & [attr.to_s.downcase.gsub(/\s+/, '_'), 'all']).present? + end if override && (v = extract_keyword!(cleaned_up_text_body, attr, options[:format])) v elsif !handler_options[:issue][attr].blank? @@ -503,11 +505,13 @@ class MailHandler < ActionMailer::Base parts.reject! do |part| part.attachment? end - parts.map do |p| - body_charset = Mail::RubyVer.respond_to?(:pick_encoding) ? - Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset - + body_charset = + if Mail::RubyVer.respond_to?(:pick_encoding) + Mail::RubyVer.pick_encoding(p.charset).to_s + else + p.charset + end body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) # convert html parts to text p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : self.class.plain_text_body_to_text(body) -- 2.39.5