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
2aa95aa0
Commit
2aa95aa0
authored
Jul 06, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code based on feedback
parent
47e17fe1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
9 deletions
+7
-9
issues.md
doc/api/issues.md
+1
-1
snippets.md
doc/api/snippets.md
+1
-1
entities.rb
lib/api/entities.rb
+1
-1
issues.rb
lib/api/issues.rb
+1
-2
snippets.rb
lib/api/snippets.rb
+1
-2
issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
snippets_spec.rb
spec/requests/api/snippets_spec.rb
+1
-1
No files found.
doc/api/issues.md
View file @
2aa95aa0
...
...
@@ -988,6 +988,6 @@ Example response:
{
"user_agent"
:
"AppleWebKit/537.36"
,
"ip_address"
:
"127.0.0.1"
,
"submitted"
:
false
"
akismet_
submitted"
:
false
}
```
doc/api/snippets.md
View file @
2aa95aa0
...
...
@@ -257,6 +257,6 @@ Example response:
{
"user_agent"
:
"AppleWebKit/537.36"
,
"ip_address"
:
"127.0.0.1"
,
"submitted"
:
false
"
akismet_
submitted"
:
false
}
```
lib/api/entities.rb
View file @
2aa95aa0
...
...
@@ -879,7 +879,7 @@ module API
class
UserAgentDetail
<
Grape
::
Entity
expose
:user_agent
expose
:ip_address
expose
:submitted
expose
:submitted
,
as: :akismet_submitted
end
end
end
lib/api/issues.rb
View file @
2aa95aa0
...
...
@@ -253,10 +253,9 @@ module API
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
present
issue
.
user_agent_detail
,
with:
Entities
::
UserAgentDetail
end
end
end
...
...
lib/api/snippets.rb
View file @
2aa95aa0
...
...
@@ -150,9 +150,8 @@ module API
get
":id/user_agent_detail"
do
authenticated_as_admin!
snippet
=
Snippet
.
find_by
(
id:
params
[
:id
])
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
...
...
spec/requests/api/issues_spec.rb
View file @
2aa95aa0
...
...
@@ -1471,7 +1471,7 @@ describe API::Issues do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'
submitted'
]).
to
be
false
expect
(
json_response
[
'
akismet_submitted'
]).
to
eq
(
user_agent_detail
.
submitted
)
end
it
"returns unautorized for non-admin users"
do
...
...
spec/requests/api/snippets_spec.rb
View file @
2aa95aa0
...
...
@@ -283,7 +283,7 @@ describe API::Snippets do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
expect
(
json_response
[
'ip_address'
]).
to
eq
(
user_agent_detail
.
ip_address
)
expect
(
json_response
[
'
submitted'
]).
to
be
false
expect
(
json_response
[
'
akismet_submitted'
]).
to
eq
(
user_agent_detail
.
submitted
)
end
it
"returns unautorized for non-admin users"
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