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
Jérome Perrin
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
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
9 deletions
+7
-9
doc/api/issues.md
doc/api/issues.md
+1
-1
doc/api/snippets.md
doc/api/snippets.md
+1
-1
lib/api/entities.rb
lib/api/entities.rb
+1
-1
lib/api/issues.rb
lib/api/issues.rb
+1
-2
lib/api/snippets.rb
lib/api/snippets.rb
+1
-2
spec/requests/api/issues_spec.rb
spec/requests/api/issues_spec.rb
+1
-1
spec/requests/api/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:
...
@@ -988,6 +988,6 @@ Example response:
{
{
"user_agent"
:
"AppleWebKit/537.36"
,
"user_agent"
:
"AppleWebKit/537.36"
,
"ip_address"
:
"127.0.0.1"
,
"ip_address"
:
"127.0.0.1"
,
"submitted"
:
false
"
akismet_
submitted"
:
false
}
}
```
```
doc/api/snippets.md
View file @
2aa95aa0
...
@@ -257,6 +257,6 @@ Example response:
...
@@ -257,6 +257,6 @@ Example response:
{
{
"user_agent"
:
"AppleWebKit/537.36"
,
"user_agent"
:
"AppleWebKit/537.36"
,
"ip_address"
:
"127.0.0.1"
,
"ip_address"
:
"127.0.0.1"
,
"submitted"
:
false
"
akismet_
submitted"
:
false
}
}
```
```
lib/api/entities.rb
View file @
2aa95aa0
...
@@ -879,7 +879,7 @@ module API
...
@@ -879,7 +879,7 @@ module API
class
UserAgentDetail
<
Grape
::
Entity
class
UserAgentDetail
<
Grape
::
Entity
expose
:user_agent
expose
:user_agent
expose
:ip_address
expose
:ip_address
expose
:submitted
expose
:submitted
,
as: :akismet_submitted
end
end
end
end
end
end
lib/api/issues.rb
View file @
2aa95aa0
...
@@ -253,10 +253,9 @@ module API
...
@@ -253,10 +253,9 @@ module API
issue
=
find_project_issue
(
params
[
:issue_iid
])
issue
=
find_project_issue
(
params
[
:issue_iid
])
return
not_found!
(
'Issue'
)
unless
issue
return
not_found!
(
'UserAgentDetail'
)
unless
issue
.
user_agent_detail
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
end
end
end
...
...
lib/api/snippets.rb
View file @
2aa95aa0
...
@@ -150,9 +150,8 @@ module API
...
@@ -150,9 +150,8 @@ module API
get
":id/user_agent_detail"
do
get
":id/user_agent_detail"
do
authenticated_as_admin!
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
return
not_found!
(
'UserAgentDetail'
)
unless
snippet
.
user_agent_detail
present
snippet
.
user_agent_detail
,
with:
Entities
::
UserAgentDetail
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
...
@@ -1471,7 +1471,7 @@ describe API::Issues do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
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
[
'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
end
it
"returns unautorized for non-admin users"
do
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
...
@@ -283,7 +283,7 @@ describe API::Snippets do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
[
'user_agent'
]).
to
eq
(
user_agent_detail
.
user_agent
)
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
[
'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
end
it
"returns unautorized for non-admin users"
do
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