From 7e71908f3d5746c080ac49fdce0d9152d32b9614 Mon Sep 17 00:00:00 2001 From: joshua stein Date: Thu, 27 Jun 2013 14:29:06 -0500 Subject: [PATCH] try not to re-wrap comments posted by e-mail at 72 chars --- script/mail_new_activity | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/mail_new_activity b/script/mail_new_activity index ef573bd..e85b7f5 100755 --- a/script/mail_new_activity +++ b/script/mail_new_activity @@ -151,7 +151,15 @@ Comment.where("id > ?", last_comment_id).order(:id).each do |c| mail.puts "" - mail.puts c.comment.to_s.force_to_ascii.word_wrap(EMAIL_WIDTH) + # if the comment has hard line breaks at <80, it likely came from an + # email, so don't re-wrap it at something shorter + com = c.comment.to_s.force_to_ascii + com_lines = com.split("\n") + if com_lines.length > 1 && com_lines.first.length < 80 + mail.puts com.word_wrap(80) + else + mail.puts com.word_wrap(EMAIL_WIDTH) + end mail.puts "" mail.puts "-- "