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
90970775
Commit
90970775
authored
Jun 04, 2019
by
Avielle Wolfe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update uses of feedback type enum
parent
f2030f1b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
ee/app/policies/vulnerabilities/feedback_policy.rb
ee/app/policies/vulnerabilities/feedback_policy.rb
+3
-3
ee/app/services/vulnerability_feedback/create_service.rb
ee/app/services/vulnerability_feedback/create_service.rb
+2
-2
ee/spec/services/vulnerability_feedback/create_service_spec.rb
...ec/services/vulnerability_feedback/create_service_spec.rb
+9
-9
No files found.
ee/app/policies/vulnerabilities/feedback_policy.rb
View file @
90970775
...
...
@@ -4,9 +4,9 @@ module Vulnerabilities
class
FeedbackPolicy
<
BasePolicy
delegate
{
@subject
.
project
}
condition
(
:issue
)
{
@subject
.
issue?
}
condition
(
:merge_request
)
{
@subject
.
merge_request?
}
condition
(
:dismissal
)
{
@subject
.
dismissal?
}
condition
(
:issue
)
{
@subject
.
issue
_type
?
}
condition
(
:merge_request
)
{
@subject
.
merge_request
_type
?
}
condition
(
:dismissal
)
{
@subject
.
dismissal
_type
?
}
rule
{
issue
&
~
can?
(
:create_issue
)
}.
prevent
:create_vulnerability_feedback
...
...
ee/app/services/vulnerability_feedback/create_service.rb
View file @
90970775
...
...
@@ -7,11 +7,11 @@ module VulnerabilityFeedback
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can?
(
current_user
,
:create_vulnerability_feedback
,
vulnerability_feedback
)
if
vulnerability_feedback
.
issue?
&&
if
vulnerability_feedback
.
issue
_type
?
&&
!
vulnerability_feedback
.
vulnerability_data
.
blank?
create_issue_for
(
vulnerability_feedback
)
elsif
vulnerability_feedback
.
merge_request?
&&
elsif
vulnerability_feedback
.
merge_request
_type
?
&&
!
vulnerability_feedback
.
vulnerability_data
.
blank?
create_merge_request_for
(
vulnerability_feedback
)
...
...
ee/spec/services/vulnerability_feedback/create_service_spec.rb
View file @
90970775
...
...
@@ -50,10 +50,10 @@ describe VulnerabilityFeedback::CreateService, '#execute' do
expect
(
feedback
.
pipeline_id
).
to
eq
(
pipeline
.
id
)
expect
(
feedback
.
category
).
to
eq
(
'sast'
)
expect
(
feedback
.
project_fingerprint
).
to
eq
(
'418291a26024a1445b23fe64de9380cdcdfd1fa8'
)
expect
(
feedback
.
dismissal?
).
to
eq
(
true
)
expect
(
feedback
.
issue?
).
to
eq
(
false
)
expect
(
feedback
.
dismissal
_type
?
).
to
eq
(
true
)
expect
(
feedback
.
issue
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
issue
).
to
be_nil
expect
(
feedback
.
merge_request?
).
to
eq
(
false
)
expect
(
feedback
.
merge_request
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
merge_request
).
to
be_nil
end
...
...
@@ -101,10 +101,10 @@ describe VulnerabilityFeedback::CreateService, '#execute' do
expect
(
feedback
.
pipeline_id
).
to
eq
(
pipeline
.
id
)
expect
(
feedback
.
category
).
to
eq
(
'sast'
)
expect
(
feedback
.
project_fingerprint
).
to
eq
(
'418291a26024a1445b23fe64de9380cdcdfd1fa8'
)
expect
(
feedback
.
dismissal?
).
to
eq
(
false
)
expect
(
feedback
.
issue?
).
to
eq
(
true
)
expect
(
feedback
.
dismissal
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
issue
_type
?
).
to
eq
(
true
)
expect
(
feedback
.
issue
).
to
be_an
(
Issue
)
expect
(
feedback
.
merge_request?
).
to
eq
(
false
)
expect
(
feedback
.
merge_request
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
merge_request
).
to
be_nil
end
...
...
@@ -176,10 +176,10 @@ describe VulnerabilityFeedback::CreateService, '#execute' do
expect
(
feedback
.
pipeline_id
).
to
eq
(
pipeline
.
id
)
expect
(
feedback
.
category
).
to
eq
(
'dependency_scanning'
)
expect
(
feedback
.
project_fingerprint
).
to
eq
(
'418291a26024a1445b23fe64de9380cdcdfd1fa8'
)
expect
(
feedback
.
dismissal?
).
to
eq
(
false
)
expect
(
feedback
.
issue?
).
to
eq
(
false
)
expect
(
feedback
.
dismissal
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
issue
_type
?
).
to
eq
(
false
)
expect
(
feedback
.
issue
).
to
be_nil
expect
(
feedback
.
merge_request?
).
to
eq
(
true
)
expect
(
feedback
.
merge_request
_type
?
).
to
eq
(
true
)
expect
(
feedback
.
merge_request
).
to
be_an
(
MergeRequest
)
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