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
Boxiang Sun
gitlab-ce
Commits
6ee87aea
Commit
6ee87aea
authored
Jul 05, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user agent details API endpoints to issues and snippets
parent
e0345c8d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
lib/api/issues.rb
lib/api/issues.rb
+17
-0
lib/api/snippets.rb
lib/api/snippets.rb
+17
-0
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
No files found.
lib/api/issues.rb
View file @
6ee87aea
...
@@ -241,6 +241,23 @@ module API
...
@@ -241,6 +241,23 @@ module API
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequestBasic
,
current_user:
current_user
,
project:
user_project
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequestBasic
,
current_user:
current_user
,
project:
user_project
end
end
desc
'Get the user agent details for an issue'
do
success
Entities
::
UserAgentDetail
end
params
do
requires
:issue_iid
,
type:
Integer
,
desc:
'The internal ID of a project issue'
end
get
":id/issues/:issue_iid/user_agent_detail"
do
authenticated_as_admin!
issue
=
find_project_issue
(
params
[
:issue_iid
])
return
not_found!
(
'Issue'
)
unless
issue
return
not_found!
(
'UserAgentDetail'
)
unless
issue
.
user_agent_detail
present
issue
.
user_agent_detail
,
with:
Entities
::
UserAgentDetail
,
current_user:
current_user
,
project:
user_project
end
end
end
end
end
end
end
lib/api/snippets.rb
View file @
6ee87aea
...
@@ -140,6 +140,23 @@ module API
...
@@ -140,6 +140,23 @@ module API
content_type
'text/plain'
content_type
'text/plain'
present
snippet
.
content
present
snippet
.
content
end
end
desc
'Get the user agent details for a snippet'
do
success
Entities
::
UserAgentDetail
end
params
do
requires
:id
,
type:
Integer
,
desc:
'The ID of a snippet'
end
get
":id/user_agent_detail"
do
authenticated_as_admin!
snippet
=
Snippet
.
find_by
(
id:
params
[
:id
])
return
not_found!
(
'Snippet'
)
unless
snippet
return
not_found!
(
'UserAgentDetail'
)
unless
snippet
.
user_agent_detail
present
snippet
.
user_agent_detail
,
with:
Entities
::
UserAgentDetail
end
end
end
end
end
end
end
spec/requests/api/issues_spec.rb
View file @
6ee87aea
...
@@ -1463,7 +1463,7 @@ describe API::Issues do
...
@@ -1463,7 +1463,7 @@ describe API::Issues do
end
end
describe
"GET /projects/:id/issues/:issue_iid/user_agent_detail"
do
describe
"GET /projects/:id/issues/:issue_iid/user_agent_detail"
do
let
(
:user_agent_detail
)
{
create
(
:user_agent_detail
,
subject:
issue
)
}
let
!
(
:user_agent_detail
)
{
create
(
:user_agent_detail
,
subject:
issue
)
}
it
'exposes known attributes'
do
it
'exposes known attributes'
do
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
admin
)
get
api
(
"/projects/
#{
project
.
id
}
/issues/
#{
issue
.
iid
}
/user_agent_detail"
,
admin
)
...
...
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