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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
d9978902
Commit
d9978902
authored
Mar 03, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq into ce-to-ee
parents
811505c7
3d6d0e1e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
17 deletions
+53
-17
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
lib/gitlab/url_builder.rb
lib/gitlab/url_builder.rb
+7
-11
spec/lib/gitlab/url_builder_spec.rb
spec/lib/gitlab/url_builder_spec.rb
+1
-1
No files found.
CHANGELOG
View file @
d9978902
...
...
@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 7.9.0 (unreleased)
- Fix merge request URL passed to Webhooks. (Stan Hu)
- 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 @
d9978902
...
...
@@ -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 @
d9978902
...
...
@@ -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 @
d9978902
.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 @
d9978902
=
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 @
d9978902
...
...
@@ -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 @
d9978902
...
...
@@ -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 @
d9978902
...
...
@@ -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
lib/gitlab/url_builder.rb
View file @
d9978902
module
Gitlab
class
UrlBuilder
include
Rails
.
application
.
routes
.
url_helpers
include
GitlabRoutingHelper
def
initialize
(
type
)
@type
=
type
...
...
@@ -9,27 +10,22 @@ module Gitlab
def
build
(
id
)
case
@type
when
:issue
issue_url
(
id
)
build_
issue_url
(
id
)
when
:merge_request
merge_request_url
(
id
)
build_
merge_request_url
(
id
)
end
end
private
def
issue_url
(
id
)
def
build_
issue_url
(
id
)
issue
=
Issue
.
find
(
id
)
namespace_project_issue_url
(
namespace_id:
issue
.
project
.
namespace
,
id:
issue
.
iid
,
project_id:
issue
.
project
,
host:
Gitlab
.
config
.
gitlab
[
'url'
])
issue_url
(
issue
,
host:
Gitlab
.
config
.
gitlab
[
'url'
])
end
def
merge_request_url
(
id
)
def
build_
merge_request_url
(
id
)
merge_request
=
MergeRequest
.
find
(
id
)
project_merge_request_url
(
id:
merge_request
.
id
,
project_id:
merge_request
.
project
,
host:
Gitlab
.
config
.
gitlab
[
'url'
])
merge_request_url
(
merge_request
,
host:
Gitlab
.
config
.
gitlab
[
'url'
])
end
end
end
spec/lib/gitlab/url_builder_spec.rb
View file @
d9978902
...
...
@@ -13,7 +13,7 @@ describe Gitlab::UrlBuilder do
it
'returns the merge request url'
do
merge_request
=
create
(
:merge_request
)
url
=
Gitlab
::
UrlBuilder
.
new
(
:merge_request
).
build
(
merge_request
.
id
)
expect
(
url
).
to
eq
"
#{
Settings
.
gitlab
[
'url'
]
}
/
#{
merge_request
.
project
.
to_param
}
/merge_requests/
#{
merge_request
.
id
}
"
expect
(
url
).
to
eq
"
#{
Settings
.
gitlab
[
'url'
]
}
/
#{
merge_request
.
project
.
path_with_namespace
}
/merge_requests/
#{
merge_request
.
i
id
}
"
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