BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
issues.rb
lib/api/issues.rb
+17
-0
snippets.rb
lib/api/snippets.rb
+17
-0
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
present
paginate
(
merge_requests
),
with:
Entities
::
MergeRequestBasic
,
current_user:
current_user
,
project:
user_project
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
lib/api/snippets.rb
View file @
6ee87aea
...
...
@@ -140,6 +140,23 @@ module API
content_type
'text/plain'
present
snippet
.
content
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
spec/requests/api/issues_spec.rb
View file @
6ee87aea
...
...
@@ -1463,7 +1463,7 @@ describe API::Issues do
end
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
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