Commit f9af7819 authored by Michał Zając's avatar Michał Zając

Use dismissed_{at,by} instead of closed_{at,by}

Change all occurrences of closed_{at,by} in Vulnerabilities-related
code to reflect the database changes.
parent 2de9f447
...@@ -20,7 +20,7 @@ class Vulnerability < ApplicationRecord ...@@ -20,7 +20,7 @@ class Vulnerability < ApplicationRecord
belongs_to :updated_by, class_name: 'User' belongs_to :updated_by, class_name: 'User'
belongs_to :last_edited_by, class_name: 'User' belongs_to :last_edited_by, class_name: 'User'
belongs_to :resolved_by, class_name: 'User' belongs_to :resolved_by, class_name: 'User'
belongs_to :closed_by, class_name: 'User' belongs_to :dismissed_by, class_name: 'User'
belongs_to :confirmed_by, class_name: 'User' belongs_to :confirmed_by, class_name: 'User'
has_many :findings, class_name: 'Vulnerabilities::Occurrence', inverse_of: :vulnerability has_many :findings, class_name: 'Vulnerabilities::Occurrence', inverse_of: :vulnerability
......
...@@ -23,7 +23,7 @@ module Vulnerabilities ...@@ -23,7 +23,7 @@ module Vulnerabilities
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
@vulnerability.update(state: Vulnerability.states[:dismissed], closed_by: @user, closed_at: Time.current) @vulnerability.update(state: Vulnerability.states[:dismissed], dismissed_by: @user, dismissed_at: Time.current)
end end
@vulnerability @vulnerability
......
...@@ -926,7 +926,7 @@ module EE ...@@ -926,7 +926,7 @@ module EE
expose :updated_by_id expose :updated_by_id
expose :last_edited_by_id expose :last_edited_by_id
expose :resolved_by_id expose :resolved_by_id
expose :closed_by_id expose :dismissed_by_id
expose :start_date expose :start_date
expose :due_date expose :due_date
...@@ -935,7 +935,7 @@ module EE ...@@ -935,7 +935,7 @@ module EE
expose :updated_at expose :updated_at
expose :last_edited_at expose :last_edited_at
expose :resolved_at expose :resolved_at
expose :closed_at expose :dismissed_at
end end
class VulnerabilityRelatedIssue < ::API::Entities::IssueBasic class VulnerabilityRelatedIssue < ::API::Entities::IssueBasic
......
...@@ -21,7 +21,7 @@ FactoryBot.define do ...@@ -21,7 +21,7 @@ FactoryBot.define do
trait :dismissed do trait :dismissed do
state { Vulnerability.states[:dismissed] } state { Vulnerability.states[:dismissed] }
closed_at { Time.current } dismissed_at { Time.current }
end end
trait :confirmed do trait :confirmed do
......
...@@ -36,7 +36,7 @@ describe Vulnerability do ...@@ -36,7 +36,7 @@ describe Vulnerability do
it { is_expected.to belong_to(:updated_by).class_name('User') } it { is_expected.to belong_to(:updated_by).class_name('User') }
it { is_expected.to belong_to(:last_edited_by).class_name('User') } it { is_expected.to belong_to(:last_edited_by).class_name('User') }
it { is_expected.to belong_to(:resolved_by).class_name('User') } it { is_expected.to belong_to(:resolved_by).class_name('User') }
it { is_expected.to belong_to(:closed_by).class_name('User') } it { is_expected.to belong_to(:dismissed_by).class_name('User') }
it { is_expected.to belong_to(:confirmed_by).class_name('User') } it { is_expected.to belong_to(:confirmed_by).class_name('User') }
it { is_expected.to have_many(:findings).class_name('Vulnerabilities::Occurrence').dependent(false) } it { is_expected.to have_many(:findings).class_name('Vulnerabilities::Occurrence').dependent(false) }
......
...@@ -199,7 +199,7 @@ describe API::Vulnerabilities do ...@@ -199,7 +199,7 @@ describe API::Vulnerabilities do
expect(response).to match_response_schema('public_api/v4/vulnerability', dir: 'ee') expect(response).to match_response_schema('public_api/v4/vulnerability', dir: 'ee')
expect(vulnerability.reload).to( expect(vulnerability.reload).to(
have_attributes(state: 'dismissed', closed_by: user, closed_at: be_like_time(Time.current))) have_attributes(state: 'dismissed', dismissed_by: user, dismissed_at: be_like_time(Time.current)))
expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback
end end
end end
......
...@@ -26,7 +26,7 @@ describe Vulnerabilities::DismissService do ...@@ -26,7 +26,7 @@ describe Vulnerabilities::DismissService do
dismiss_vulnerability dismiss_vulnerability
expect(vulnerability.reload).to( expect(vulnerability.reload).to(
have_attributes(state: 'dismissed', closed_by: user, closed_at: be_like_time(Time.current))) have_attributes(state: 'dismissed', dismissed_by: user, dismissed_at: be_like_time(Time.current)))
expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback expect(vulnerability.findings).to all have_vulnerability_dismissal_feedback
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment