Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
32f92a50
Commit
32f92a50
authored
Jul 01, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#501] Ugly patch to stop creating journals when only line endings change
parent
66c4db86
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
issue.rb
app/models/issue.rb
+7
-0
issue_test.rb
test/unit/issue_test.rb
+18
-0
No files found.
app/models/issue.rb
View file @
32f92a50
...
...
@@ -280,6 +280,13 @@ class Issue < ActiveRecord::Base
end
end
# Bug #501: browsers might swap the line endings causing a Journal.
if
attrs
.
has_key?
(
'description'
)
&&
attrs
[
'description'
].
present?
if
attrs
[
'description'
].
gsub
(
/\r\n?/
,
"
\n
"
)
==
self
.
description
attrs
.
delete
(
'description'
)
end
end
self
.
attributes
=
attrs
end
...
...
test/unit/issue_test.rb
View file @
32f92a50
...
...
@@ -875,4 +875,22 @@ class IssueTest < ActiveSupport::TestCase
assert
issue
.
save
assert_equal
0
,
ActionMailer
::
Base
.
deliveries
.
size
end
test
'changing the line endings in a description will not be recorded as a Journal'
do
User
.
current
=
User
.
find
(
1
)
issue
=
Issue
.
find
(
1
)
issue
.
update_attribute
(
:description
,
"Description with newlines
\n\n
embedded"
)
issue
.
reload
assert
issue
.
description
.
include?
(
"
\n
"
)
assert_no_difference
(
"Journal.count"
)
do
issue
.
safe_attributes
=
{
'description'
=>
"Description with newlines
\r\n\r\n
embedded"
}
assert
issue
.
save
end
assert_equal
"Description with newlines
\n\n
embedded"
,
issue
.
reload
.
description
end
end
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