Skip to content
Snippets Groups Projects
Verified Commit c77d7fe6 authored by Marcos Rocha's avatar Marcos Rocha
Browse files

Update Vulnerabilities::ResolveService

After the #324860
 is merged, a Vulnerability will be
created when a user interacts with a finding.
A Vulnerability Feedback object will not be created
anymore.

Changelog: fixed
EE: true
parent cb519be8
No related branches found
No related tags found
1 merge request!90542Update Vulnerabilities::ResolveService
......@@ -7,8 +7,12 @@ class ResolveService < BaseService
def execute
raise Gitlab::Access::AccessDeniedError unless authorized?
update_vulnerability_with(state: Vulnerability.states[:resolved], resolved_by: @user, resolved_at: Time.current) do
DestroyDismissalFeedbackService.new(@user, @vulnerability).execute
if Feature.enabled?(:deprecate_vulnerabilities_feedback, @vulnerability.project)
update_vulnerability_with(state: Vulnerability.states[:resolved], resolved_by: @user, resolved_at: Time.current)
else
update_vulnerability_with(state: Vulnerability.states[:resolved], resolved_by: @user, resolved_at: Time.current) do
DestroyDismissalFeedbackService.new(@user, @vulnerability).execute
end
end
@vulnerability
......
......@@ -23,7 +23,14 @@
end
it_behaves_like 'calls vulnerability statistics utility services in order'
it_behaves_like 'removes dismissal feedback from associated findings'
context 'when feature flag deprecate_vulnerabilities_feedback is disabled' do
before do
stub_feature_flags(deprecate_vulnerabilities_feedback: false)
end
it_behaves_like 'removes dismissal feedback from associated findings'
end
it 'resolves a vulnerability' do
freeze_time do
......@@ -40,6 +47,12 @@
resolve_vulnerability
end
it 'does not remove the feedback from associated findings' do
expect(Vulnerabilities::DestroyDismissalFeedbackService).not_to receive(:new).with(user, vulnerability)
resolve_vulnerability
end
context 'when security dashboard feature is disabled' do
before do
stub_licensed_features(security_dashboard: false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment