Mercurial > hg > soundsoftware-site
diff app/models/mail_handler.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children | fb9a13467253 |
line wrap: on
line diff
--- a/app/models/mail_handler.rb Tue Sep 09 09:28:31 2014 +0100 +++ b/app/models/mail_handler.rb Tue Sep 09 09:29:00 2014 +0100 @@ -190,6 +190,7 @@ issue.subject = '(no subject)' end issue.description = cleaned_up_text_body + issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date? # add To and Cc as watchers before saving so the watchers can reply to Redmine add_watchers(issue) @@ -296,8 +297,9 @@ if user.allowed_to?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase} unless addresses.empty? - watchers = User.active.where('LOWER(mail) IN (?)', addresses).all - watchers.each {|w| obj.add_watcher(w)} + User.active.where('LOWER(mail) IN (?)', addresses).each do |w| + obj.add_watcher(w) + end end end end @@ -410,7 +412,11 @@ part.header[:content_disposition].try(:disposition_type) == 'attachment' end - @plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n") + @plain_text_body = parts.map do |p| + body_charset = p.charset.respond_to?(:force_encoding) ? + Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset + Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) + end.join("\r\n") # strip html tags and remove doctype directive if parts.any? {|p| p.mime_type == 'text/html'}