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
Jérome Perrin
gitlab-ce
Commits
b8c9257f
Commit
b8c9257f
authored
Mar 02, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where editing a comment with "+1" or "-1" would cause a server error
Closes #1151
parent
f84bd771
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
5 deletions
+45
-5
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/notes_controller.rb
app/controllers/projects/notes_controller.rb
+7
-1
app/helpers/notes_helper.rb
app/helpers/notes_helper.rb
+3
-3
app/views/projects/notes/_edit_form.html.haml
app/views/projects/notes/_edit_form.html.haml
+1
-0
app/views/projects/notes/_form.html.haml
app/views/projects/notes/_form.html.haml
+1
-1
features/project/commits/comments.feature
features/project/commits/comments.feature
+6
-0
features/project/issues/issues.feature
features/project/issues/issues.feature
+9
-0
features/steps/shared/note.rb
features/steps/shared/note.rb
+17
-0
No files found.
CHANGELOG
View file @
b8c9257f
Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased)
- Fix bug that caused a server error when editing a comment to "+1" or "-1" (Stan Hu)
- Move labels/milestones tabs to sidebar
- Upgrade Rails gem to version 4.1.9.
- Improve error messages for file edit failures
...
...
app/controllers/projects/notes_controller.rb
View file @
b8c9257f
...
...
@@ -3,10 +3,10 @@ class Projects::NotesController < Projects::ApplicationController
before_filter
:authorize_read_note!
before_filter
:authorize_write_note!
,
only:
[
:create
]
before_filter
:authorize_admin_note!
,
only:
[
:update
,
:destroy
]
before_filter
:find_current_user_notes
,
except:
[
:destroy
,
:delete_attachment
]
def
index
current_fetched_at
=
Time
.
now
.
to_i
@notes
=
NotesFinder
.
new
.
execute
(
project
,
current_user
,
params
)
notes_json
=
{
notes:
[],
last_fetched_at:
current_fetched_at
}
...
...
@@ -116,4 +116,10 @@ class Projects::NotesController < Projects::ApplicationController
:attachment
,
:line_code
,
:commit_id
)
end
private
def
find_current_user_notes
@notes
=
NotesFinder
.
new
.
execute
(
project
,
current_user
,
params
)
end
end
app/helpers/notes_helper.rb
View file @
b8c9257f
...
...
@@ -4,9 +4,9 @@ module NotesHelper
(
@noteable
.
class
.
name
==
note
.
noteable_type
&&
!
note
.
for_diff_line?
)
end
def
note_target_fields
hidden_field_tag
(
:target_type
,
@target_typ
e
)
+
hidden_field_tag
(
:target_id
,
@target_
id
)
def
note_target_fields
(
note
)
hidden_field_tag
(
:target_type
,
note
.
noteable
.
class
.
name
.
underscor
e
)
+
hidden_field_tag
(
:target_id
,
note
.
noteable
.
id
)
end
def
link_to_commit_diff_line_note
(
note
)
...
...
app/views/projects/notes/_edit_form.html.haml
View file @
b8c9257f
.note-edit-form
=
form_for
note
,
url:
namespace_project_note_path
(
@project
.
namespace
,
@project
,
note
),
method: :put
,
remote:
true
,
authenticity_token:
true
do
|
f
|
=
note_target_fields
(
note
)
=
render
layout:
'projects/md_preview'
,
locals:
{
preview_class:
"note-text"
}
do
=
render
'projects/zen'
,
f:
f
,
attr: :note
,
classes:
'note_text js-note-text'
...
...
app/views/projects/notes/_form.html.haml
View file @
b8c9257f
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
,
@note
],
remote:
true
,
html:
{
:'data-type'
=>
'json'
,
multipart:
true
,
id:
nil
,
class:
"new_note js-new-note-form common-note-form gfm-form"
},
authenticity_token:
true
do
|
f
|
=
note_target_fields
=
note_target_fields
(
@note
)
=
f
.
hidden_field
:commit_id
=
f
.
hidden_field
:line_code
=
f
.
hidden_field
:noteable_id
...
...
features/project/commits/comments.feature
View file @
b8c9257f
...
...
@@ -41,3 +41,9 @@ Feature: Project Commits Comments
Given
I leave a comment like
"XML attached"
And
I delete a comment
Then
I should not see a comment saying
"XML attached"
@javascript
Scenario
:
I
can edit a comment with +1
Given
I leave a comment like
"XML attached"
And
I edit the last comment with a +1
Then
I should see +1 in the description
features/project/issues/issues.feature
View file @
b8c9257f
...
...
@@ -139,6 +139,15 @@ Feature: Project Issues
And
I leave a comment with task markdown
Then
I should not see task checkboxes in the comment
@javascript
Scenario
:
Issue notes should be editable with +1
Given
project
"Shop"
has
"Tasks-open"
open issue with task markdown
When
I visit issue page
"Tasks-open"
And
I leave a comment with a header containing
"Comment with a header"
Then
The comment with the header should not have an ID
And
I edit the last comment with a +1
Then
I should see +1 in the description
# Task status in issues list
Scenario
:
Issues list should display task status
...
...
features/steps/shared/note.rb
View file @
b8c9257f
...
...
@@ -135,4 +135,21 @@ module SharedNote
'li.note div.timeline-content input[type="checkbox"]'
)
end
step
'I edit the last comment with a +1'
do
find
(
".note"
).
hover
find
(
'.js-note-edit'
).
click
within
(
".current-note-edit-form"
)
do
fill_in
'note[note]'
,
with:
'+1 Awesome!'
click_button
'Save Comment'
sleep
0.05
end
end
step
'I should see +1 in the description'
do
within
(
".note"
)
do
page
.
should
have_content
(
"+1 Awesome!"
)
end
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