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
f3e2dc43
Commit
f3e2dc43
authored
Jan 26, 2021
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate description from finding if needed
parent
1252d865
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
ee/app/presenters/vulnerability_presenter.rb
ee/app/presenters/vulnerability_presenter.rb
+4
-0
ee/changelogs/unreleased/284473-issues-created-from-vulnerabilities-detail-page-missing-informa.yml
...ated-from-vulnerabilities-detail-page-missing-informa.yml
+5
-0
ee/spec/presenters/vulnerability_presenter_spec.rb
ee/spec/presenters/vulnerability_presenter_spec.rb
+23
-1
No files found.
ee/app/presenters/vulnerability_presenter.rb
View file @
f3e2dc43
...
...
@@ -52,6 +52,10 @@ class VulnerabilityPresenter < Gitlab::View::Presenter::Delegated
)
end
def
description
vulnerability
.
description
||
finding
.
description
end
private
def
location_link_for
(
path
)
...
...
ee/changelogs/unreleased/284473-issues-created-from-vulnerabilities-detail-page-missing-informa.yml
0 → 100644
View file @
f3e2dc43
---
title
:
Properly populate descriptions in an issue created from a vulnerability
merge_request
:
52592
author
:
type
:
fixed
ee/spec/presenters/vulnerability_presenter_spec.rb
View file @
f3e2dc43
...
...
@@ -9,7 +9,7 @@ RSpec.describe VulnerabilityPresenter do
{
type:
'sast'
,
status:
'success'
,
start_time:
'placeholder'
,
end_time:
'placeholder'
}
end
let_it_be
(
:finding
)
{
create
(
:vulnerabilities_finding
,
:with_secret_detection
,
pipelines:
[
pipeline
],
project:
project
)
}
let_it_be
(
:finding
)
{
create
(
:vulnerabilities_finding
,
:with_secret_detection
,
pipelines:
[
pipeline
],
project:
project
,
description:
'Finding Description'
)
}
let_it_be
(
:finding2
)
{
create
(
:vulnerabilities_finding
,
:with_secret_detection
,
scan:
sast_scan
)
}
subject
{
described_class
.
new
(
finding
.
vulnerability
)
}
...
...
@@ -127,4 +127,26 @@ RSpec.describe VulnerabilityPresenter do
expect
(
jira_issue_description
).
to
eq
(
expected_jira_issue_description
)
end
end
describe
'#description'
do
let
(
:vulnerability
)
{
finding
.
vulnerability
}
context
'when the vulnerability description field is populated'
do
it
'returns the description for the vulnerability'
do
expect
(
subject
.
description
).
to
eq
(
vulnerability
.
description
)
end
end
context
'when the vulnerability description field is empty'
do
before
do
vulnerability
.
description
=
nil
vulnerability
.
save!
end
it
'returns the description for the vulnerability finding'
do
expect
(
subject
.
description
).
not_to
eq
(
vulnerability
.
description
)
expect
(
subject
.
description
).
to
eq
(
finding
.
description
)
end
end
end
end
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