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
7a8d0aab
Commit
7a8d0aab
authored
Feb 15, 2017
by
Mark Fletcher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure only commit comments relevant to target project are returned
parent
865e3fcc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
changelogs/unreleased/27873-when-a-commit-appears-in-several-projects-commit-comments-are-shared-across-projects.yml
...l-projects-commit-comments-are-shared-across-projects.yml
+4
-0
lib/api/commits.rb
lib/api/commits.rb
+1
-1
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+14
-0
No files found.
changelogs/unreleased/27873-when-a-commit-appears-in-several-projects-commit-comments-are-shared-across-projects.yml
0 → 100644
View file @
7a8d0aab
---
title
:
Only return target project's comments for a commit
merge_request
:
author
:
lib/api/commits.rb
View file @
7a8d0aab
...
@@ -114,7 +114,7 @@ module API
...
@@ -114,7 +114,7 @@ module API
commit
=
user_project
.
commit
(
params
[
:sha
])
commit
=
user_project
.
commit
(
params
[
:sha
])
not_found!
'Commit'
unless
commit
not_found!
'Commit'
unless
commit
notes
=
Note
.
where
(
commit_id:
commit
.
id
).
order
(
:created_at
)
notes
=
user_project
.
notes
.
where
(
commit_id:
commit
.
id
).
order
(
:created_at
)
present
paginate
(
notes
),
with:
Entities
::
CommitNote
present
paginate
(
notes
),
with:
Entities
::
CommitNote
end
end
...
...
spec/requests/api/commits_spec.rb
View file @
7a8d0aab
...
@@ -464,6 +464,20 @@ describe API::Commits, api: true do
...
@@ -464,6 +464,20 @@ describe API::Commits, api: true do
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_http_status
(
401
)
end
end
end
end
context
'when the commit is present on two projects'
do
let
(
:forked_project
)
{
create
(
:project
,
:repository
,
creator:
user2
,
namespace:
user2
.
namespace
)
}
let!
(
:forked_project_note
)
{
create
(
:note_on_commit
,
author:
user2
,
project:
forked_project
,
commit_id:
forked_project
.
repository
.
commit
.
id
,
note:
'a comment on a commit for fork'
)
}
it
'returns the comments for the target project'
do
get
api
(
"/projects/
#{
forked_project
.
id
}
/repository/commits/
#{
forked_project
.
repository
.
commit
.
id
}
/comments"
,
user2
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'note'
]).
to
eq
(
'a comment on a commit for fork'
)
expect
(
json_response
.
first
[
'author'
][
'id'
]).
to
eq
(
user2
.
id
)
end
end
end
end
describe
'POST :id/repository/commits/:sha/cherry_pick'
do
describe
'POST :id/repository/commits/:sha/cherry_pick'
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