Revert "allow empty-quotes"
This reverts commit 4f2f678aff8d7dfcac96c47cf7eb480a5707ddaf.
This commit is contained in:
parent
5603127699
commit
f02f238d52
3 changed files with 6 additions and 17 deletions
|
@ -18,6 +18,10 @@ module Gitlab
|
||||||
# not using /\s+$/ here because that deletes empty lines
|
# not using /\s+$/ here because that deletes empty lines
|
||||||
body = body.gsub(/[ \t]$/, '')
|
body = body.gsub(/[ \t]$/, '')
|
||||||
|
|
||||||
|
# TODO [jneen]: do we want to allow empty-quoting? (replies only containing a blockquote)
|
||||||
|
# EmailReplyTrimmer allows this as a special case, so we detect it manually here.
|
||||||
|
return "" if body.lines.all? { |l| l.strip.empty? || l.start_with?('>') }
|
||||||
|
|
||||||
body.force_encoding(encoding).encode("UTF-8")
|
body.force_encoding(encoding).encode("UTF-8")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -15,23 +15,8 @@ describe Gitlab::Email::ReplyParser, lib: true do
|
||||||
expect(test_parse_body("asdf" * 30)).to eq("")
|
expect(test_parse_body("asdf" * 30)).to eq("")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the quote for an empty-quoted comment" do
|
it "returns an empty string if there is no reply content" do
|
||||||
expect(test_parse_body(fixture_file("emails/empty_quote.eml")))
|
expect(test_parse_body(fixture_file("emails/no_content_reply.eml"))).to eq("")
|
||||||
.to eq(<<-BODY.strip_heredoc.chomp)
|
|
||||||
>
|
|
||||||
>
|
|
||||||
>
|
|
||||||
> eviltrout posted in 'Adventure Time Sux' on Discourse Meta:
|
|
||||||
>
|
|
||||||
> ---
|
|
||||||
> hey guys everyone knows adventure time sucks!
|
|
||||||
>
|
|
||||||
> ---
|
|
||||||
> Please visit this link to respond: http://localhost:3000/t/adventure-time-sux/1234/3
|
|
||||||
>
|
|
||||||
> To unsubscribe from these emails, visit your [user preferences](http://localhost:3000/user_preferences).
|
|
||||||
>
|
|
||||||
BODY
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "properly renders plaintext-only email" do
|
it "properly renders plaintext-only email" do
|
||||||
|
|
Loading…
Reference in a new issue