Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
f02f238d
Commit
f02f238d
authored
Dec 13, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "allow empty-quotes"
This reverts commit 4f2f678aff8d7dfcac96c47cf7eb480a5707ddaf.
parent
56031276
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
17 deletions
+6
-17
lib/gitlab/email/reply_parser.rb
lib/gitlab/email/reply_parser.rb
+4
-0
spec/fixtures/emails/no_content_reply.eml
spec/fixtures/emails/no_content_reply.eml
+0
-0
spec/lib/gitlab/email/reply_parser_spec.rb
spec/lib/gitlab/email/reply_parser_spec.rb
+2
-17
No files found.
lib/gitlab/email/reply_parser.rb
View file @
f02f238d
...
...
@@ -18,6 +18,10 @@ module Gitlab
# not using /\s+$/ here because that deletes empty lines
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"
)
end
...
...
spec/fixtures/emails/
empty_quote
.eml
→
spec/fixtures/emails/
no_content_reply
.eml
View file @
f02f238d
File moved
spec/lib/gitlab/email/reply_parser_spec.rb
View file @
f02f238d
...
...
@@ -15,23 +15,8 @@ describe Gitlab::Email::ReplyParser, lib: true do
expect
(
test_parse_body
(
"asdf"
*
30
)).
to
eq
(
""
)
end
it
"returns the quote for an empty-quoted comment"
do
expect
(
test_parse_body
(
fixture_file
(
"emails/empty_quote.eml"
)))
.
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
it
"returns an empty string if there is no reply content"
do
expect
(
test_parse_body
(
fixture_file
(
"emails/no_content_reply.eml"
))).
to
eq
(
""
)
end
it
"properly renders plaintext-only email"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment