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
460eef56
Commit
460eef56
authored
Aug 17, 2020
by
Jonathan Schafer
Committed by
Mayra Cabrera
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use issue links to determine vulnerability issue feedback
parent
6d59e61c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
ee/app/models/vulnerabilities/finding.rb
ee/app/models/vulnerabilities/finding.rb
+1
-1
ee/spec/models/vulnerabilities/finding_spec.rb
ee/spec/models/vulnerabilities/finding_spec.rb
+24
-0
No files found.
ee/app/models/vulnerabilities/finding.rb
View file @
460eef56
...
@@ -211,7 +211,7 @@ module Vulnerabilities
...
@@ -211,7 +211,7 @@ module Vulnerabilities
end
end
def
issue_feedback
def
issue_feedback
feedback
(
feedback_type:
'issue'
)
Vulnerabilities
::
Feedback
.
find_by
(
issue:
vulnerability
&
.
related_issues
)
if
vulnerability
end
end
def
merge_request_feedback
def
merge_request_feedback
...
...
ee/spec/models/vulnerabilities/finding_spec.rb
View file @
460eef56
...
@@ -375,6 +375,9 @@ RSpec.describe Vulnerabilities::Finding do
...
@@ -375,6 +375,9 @@ RSpec.describe Vulnerabilities::Finding do
)
)
end
end
let
(
:vulnerability
)
{
create
(
:vulnerability
,
findings:
[
finding
])
}
let!
(
:issue_link
)
{
create
(
:vulnerabilities_issue_link
,
vulnerability:
vulnerability
,
issue:
issue
)}
it
'returns associated feedback'
do
it
'returns associated feedback'
do
feedback
=
finding
.
issue_feedback
feedback
=
finding
.
issue_feedback
...
@@ -383,6 +386,27 @@ RSpec.describe Vulnerabilities::Finding do
...
@@ -383,6 +386,27 @@ RSpec.describe Vulnerabilities::Finding do
expect
(
feedback
[
:feedback_type
]).
to
eq
'issue'
expect
(
feedback
[
:feedback_type
]).
to
eq
'issue'
expect
(
feedback
[
:issue_id
]).
to
eq
issue
.
id
expect
(
feedback
[
:issue_id
]).
to
eq
issue
.
id
end
end
context
'when there is no feedback for the vulnerability'
do
let
(
:vulnerability_no_feedback
)
{
create
(
:vulnerability
,
findings:
[
finding_no_feedback
])
}
let!
(
:finding_no_feedback
)
{
create
(
:vulnerabilities_finding
,
:dependency_scanning
,
project:
project
)
}
it
'does not return unassociated feedback'
do
feedback
=
finding_no_feedback
.
issue_feedback
expect
(
feedback
).
not_to
be_present
end
end
context
'when there is no vulnerability associated with the finding'
do
let!
(
:finding_no_vulnerability
)
{
create
(
:vulnerabilities_finding
,
:dependency_scanning
,
project:
project
)
}
it
'does not return feedback'
do
feedback
=
finding_no_vulnerability
.
issue_feedback
expect
(
feedback
).
not_to
be_present
end
end
end
end
describe
'#dismissal_feedback'
do
describe
'#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