Skip to content
代码片段 群组 项目
提交 0a0d2e1a 编辑于 作者: mc_rocha's avatar mc_rocha 提交者: Sean McGivern
浏览文件

Update Vulnerabilities Confirm Service

After the https://gitlab.com/gitlab-org/gitlab/-/issues/324860
 is merged, a Vulnerability will be
created when a user interacts with a finding.
There will be no Vulnerability Feedback object to be
destroyed when a vulnerability is confirmed.

Changelog: fixed
EE: true
上级 52036352
No related branches found
No related tags found
无相关合并请求
......@@ -7,8 +7,14 @@ class ConfirmService < BaseService
def execute
raise Gitlab::Access::AccessDeniedError unless authorized?
update_vulnerability_with(state: Vulnerability.states[:confirmed], confirmed_by: @user, confirmed_at: Time.current) do
DestroyDismissalFeedbackService.new(@user, @vulnerability).execute
if Feature.enabled?(:deprecate_vulnerabilities_feedback, @vulnerability.project)
update_vulnerability_with(state: Vulnerability.states[:confirmed], confirmed_by: @user,
confirmed_at: Time.current)
else
update_vulnerability_with(state: Vulnerability.states[:confirmed], confirmed_by: @user,
confirmed_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 'confirms a vulnerability' do
freeze_time do
......@@ -40,6 +47,12 @@
confirm_vulnerability
end
it 'does not remove the feedback from associated findings' do
expect(Vulnerabilities::DestroyDismissalFeedbackService).not_to receive(:new).with(user, vulnerability)
confirm_vulnerability
end
context 'when security dashboard feature is disabled' do
before do
stub_licensed_features(security_dashboard: false)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册