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
a421ebba
Commit
a421ebba
authored
Oct 18, 2019
by
Victor Zagorodny
Committed by
James Lopez
Oct 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respond with 304 Not Modified if Vulnerability is already dismissed
parent
f977d2d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
ee/lib/api/vulnerabilities.rb
ee/lib/api/vulnerabilities.rb
+2
-0
ee/spec/requests/api/vulnerabilities_spec.rb
ee/spec/requests/api/vulnerabilities_spec.rb
+10
-0
No files found.
ee/lib/api/vulnerabilities.rb
View file @
a421ebba
...
@@ -44,6 +44,8 @@ module API
...
@@ -44,6 +44,8 @@ module API
post
':id/dismiss'
do
post
':id/dismiss'
do
if
Feature
.
enabled?
(
:first_class_vulnerabilities
)
if
Feature
.
enabled?
(
:first_class_vulnerabilities
)
vulnerability
=
find_and_authorize_vulnerability!
(
:dismiss_vulnerability
)
vulnerability
=
find_and_authorize_vulnerability!
(
:dismiss_vulnerability
)
break
not_modified!
if
vulnerability
.
closed?
vulnerability
=
::
Vulnerabilities
::
DismissService
.
new
(
current_user
,
vulnerability
).
execute
vulnerability
=
::
Vulnerabilities
::
DismissService
.
new
(
current_user
,
vulnerability
).
execute
render_vulnerability
(
vulnerability
)
render_vulnerability
(
vulnerability
)
else
else
...
...
ee/spec/requests/api/vulnerabilities_spec.rb
View file @
a421ebba
...
@@ -111,6 +111,16 @@ describe API::Vulnerabilities do
...
@@ -111,6 +111,16 @@ describe API::Vulnerabilities do
expect
(
response
).
to
have_gitlab_http_status
(
403
)
expect
(
response
).
to
have_gitlab_http_status
(
403
)
end
end
end
end
context
'if a vulnerability is already dismissed'
do
let
(
:vulnerability
)
{
create
(
:vulnerability
,
:closed
,
project:
project
)
}
it
'responds with 304 Not Modified'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
304
)
end
end
end
end
context
'when user does not have permissions to create a dismissal feedback'
do
context
'when user does not have permissions to create a dismissal feedback'
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