@@ -436,7 +436,7 class MailHandler < ActionMailer::Base | |||||
436 |
|
436 | |||
437 | body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) |
|
437 | body = Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) | |
438 | # convert html parts to text |
|
438 | # convert html parts to text | |
439 | p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : body |
|
439 | p.mime_type == 'text/html' ? self.class.html_body_to_text(body) : self.class.plain_text_body_to_text(body) | |
440 | end.join("\r\n") |
|
440 | end.join("\r\n") | |
441 |
|
441 | |||
442 | @plain_text_body |
|
442 | @plain_text_body | |
@@ -456,6 +456,13 class MailHandler < ActionMailer::Base | |||||
456 | Redmine::WikiFormatting.html_parser.to_text(html) |
|
456 | Redmine::WikiFormatting.html_parser.to_text(html) | |
457 | end |
|
457 | end | |
458 |
|
458 | |||
|
459 | # Converts a plain/text email body to text | |||
|
460 | def self.plain_text_body_to_text(text) | |||
|
461 | # Removes leading spaces that would cause the line to be rendered as | |||
|
462 | # preformatted text with textile | |||
|
463 | text.gsub(/^ +(?![*#])/, '') | |||
|
464 | end | |||
|
465 | ||||
459 | def self.assign_string_attribute_with_limit(object, attribute, value, limit=nil) |
|
466 | def self.assign_string_attribute_with_limit(object, attribute, value, limit=nil) | |
460 | limit ||= object.class.columns_hash[attribute.to_s].limit || 255 |
|
467 | limit ||= object.class.columns_hash[attribute.to_s].limit || 255 | |
461 | value = value.to_s.slice(0, limit) |
|
468 | value = value.to_s.slice(0, limit) |
General Comments 0
You need to be logged in to leave comments.
Login now