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
84695432
Commit
84695432
authored
Apr 06, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Multiple issue assignees] Fix legacy API v4. Only first assignees is taking into account
parent
0e09fdc9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
14 deletions
+32
-14
lib/api/v3/entities.rb
lib/api/v3/entities.rb
+7
-0
lib/api/v3/helpers.rb
lib/api/v3/helpers.rb
+8
-0
lib/api/v3/issues.rb
lib/api/v3/issues.rb
+17
-14
No files found.
lib/api/v3/entities.rb
View file @
84695432
...
...
@@ -295,6 +295,13 @@ module API
expose
:project_id
,
:issues_events
,
:merge_requests_events
expose
:note_events
,
:build_events
,
:pipeline_events
,
:wiki_page_events
end
class
Issue
<
::
API
::
Entities
::
Issue
unexpose
:assignees
expose
:assignee
do
|
issue
,
options
|
::
API
::
Entities
::
UserBasic
.
represent
(
issue
.
assignees
.
first
,
options
)
end
end
end
end
end
lib/api/v3/helpers.rb
View file @
84695432
...
...
@@ -14,6 +14,14 @@ module API
authorize!
access_level
,
merge_request
merge_request
end
def
convert_parameters_from_legacy_format
(
params
)
if
params
[
:assignee_id
].
present?
params
[
:assignee_ids
]
=
[
params
.
delete
(
:assignee_id
)]
end
params
end
end
end
end
lib/api/v3/issues.rb
View file @
84695432
...
...
@@ -8,6 +8,7 @@ module API
helpers
do
def
find_issues
(
args
=
{})
args
=
params
.
merge
(
args
)
args
=
convert_parameters_from_legacy_format
(
args
)
args
.
delete
(
:id
)
args
[
:milestone_title
]
=
args
.
delete
(
:milestone
)
...
...
@@ -53,7 +54,7 @@ module API
resource
:issues
do
desc
"Get currently authenticated user's issues"
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'all'
,
...
...
@@ -62,7 +63,7 @@ module API
end
get
do
issues
=
find_issues
(
scope:
'authored'
)
present
paginate
(
issues
),
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
present
paginate
(
issues
),
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
end
end
...
...
@@ -71,7 +72,7 @@ module API
end
resource
:groups
,
requirements:
{
id:
%r{[^/]+}
}
do
desc
'Get a list of group issues'
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'opened'
,
...
...
@@ -83,7 +84,7 @@ module API
issues
=
find_issues
(
group_id:
group
.
id
,
state:
params
[
:state
]
||
'opened'
,
match_all_labels:
true
)
present
paginate
(
issues
),
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
present
paginate
(
issues
),
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
end
end
...
...
@@ -95,7 +96,7 @@ module API
desc
'Get a list of project issues'
do
detail
'iid filter is deprecated have been removed on V4'
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
optional
:state
,
type:
String
,
values:
%w[opened closed all]
,
default:
'all'
,
...
...
@@ -108,22 +109,22 @@ module API
issues
=
find_issues
(
project_id:
project
.
id
)
present
paginate
(
issues
),
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
present
paginate
(
issues
),
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
end
desc
'Get a single project issue'
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
requires
:issue_id
,
type:
Integer
,
desc:
'The ID of a project issue'
end
get
":id/issues/:issue_id"
do
issue
=
find_project_issue
(
params
[
:issue_id
])
present
issue
,
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
present
issue
,
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
end
desc
'Create a new project issue'
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
requires
:title
,
type:
String
,
desc:
'The title of an issue'
...
...
@@ -141,6 +142,7 @@ module API
issue_params
=
declared_params
(
include_missing:
false
)
issue_params
=
issue_params
.
merge
(
merge_request_to_resolve_discussions_of:
issue_params
.
delete
(
:merge_request_for_resolving_discussions
))
issue_params
=
convert_parameters_from_legacy_format
(
issue_params
)
issue
=
::
Issues
::
CreateService
.
new
(
user_project
,
current_user
,
...
...
@@ -148,14 +150,14 @@ module API
render_spam_error!
if
issue
.
spam?
if
issue
.
valid?
present
issue
,
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
present
issue
,
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
else
render_validation_error!
(
issue
)
end
end
desc
'Update an existing issue'
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
requires
:issue_id
,
type:
Integer
,
desc:
'The ID of a project issue'
...
...
@@ -178,6 +180,7 @@ module API
end
update_params
=
declared_params
(
include_missing:
false
).
merge
(
request:
request
,
api:
true
)
update_params
=
convert_parameters_from_legacy_format
(
update_params
)
issue
=
::
Issues
::
UpdateService
.
new
(
user_project
,
current_user
,
...
...
@@ -186,14 +189,14 @@ module API
render_spam_error!
if
issue
.
spam?
if
issue
.
valid?
present
issue
,
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
present
issue
,
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
else
render_validation_error!
(
issue
)
end
end
desc
'Move an existing issue'
do
success
::
API
::
Entities
::
Issue
success
::
API
::
V3
::
Entities
::
Issue
end
params
do
requires
:issue_id
,
type:
Integer
,
desc:
'The ID of a project issue'
...
...
@@ -208,7 +211,7 @@ module API
begin
issue
=
::
Issues
::
MoveService
.
new
(
user_project
,
current_user
).
execute
(
issue
,
new_project
)
present
issue
,
with:
::
API
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
present
issue
,
with:
::
API
::
V3
::
Entities
::
Issue
,
current_user:
current_user
,
project:
user_project
rescue
::
Issues
::
MoveService
::
MoveError
=>
error
render_api_error!
(
error
.
message
,
400
)
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