From a16607cc5b64507e8d5edf894c0620c7dd293279 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Sun, 24 Sep 2023 16:13:52 +0100 Subject: [PATCH] Rename state_changed event_type We're going to rename this to `status_changed` to better represent how we show it to users. --- app/components/timeline_entry/component.rb | 6 +++--- app/models/timeline_event.rb | 6 +++--- config/locales/components.en.yml | 4 ++-- spec/components/timeline_entry_spec.rb | 2 +- spec/models/timeline_event_spec.rb | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/components/timeline_entry/component.rb b/app/components/timeline_entry/component.rb index 642f5b66ef..f3cc333f08 100644 --- a/app/components/timeline_entry/component.rb +++ b/app/components/timeline_entry/component.rb @@ -41,16 +41,16 @@ def description_vars private - def state_changed_vars + def status_changed_vars { - old_state: + old_status: render( StatusTag::Component.new( timeline_event.old_value, class_context: "timeline-event", ), ).strip, - new_state: + new_status: render( StatusTag::Component.new( timeline_event.new_value, diff --git a/app/models/timeline_event.rb b/app/models/timeline_event.rb index 768eab2c48..a1723aa904 100644 --- a/app/models/timeline_event.rb +++ b/app/models/timeline_event.rb @@ -74,7 +74,7 @@ class TimelineEvent < ApplicationRecord requestable_requested: "requestable_requested", reviewer_assigned: "reviewer_assigned", stage_changed: "stage_changed", - state_changed: "state_changed", + status_changed: "status_changed", } validates :creator, presence: true, unless: -> { creator_name.present? } @@ -144,14 +144,14 @@ class TimelineEvent < ApplicationRecord presence: true, if: -> do action_required_by_changed? || assessment_section_recorded? || - information_changed? || stage_changed? || state_changed? + information_changed? || stage_changed? || status_changed? end validates :old_value, :new_value, absence: true, unless: -> do action_required_by_changed? || assessment_section_recorded? || - information_changed? || stage_changed? || state_changed? + information_changed? || stage_changed? || status_changed? end validates :column_name, presence: true, if: :information_changed? diff --git a/config/locales/components.en.yml b/config/locales/components.en.yml index f6feb00781..e90c63d706 100644 --- a/config/locales/components.en.yml +++ b/config/locales/components.en.yml @@ -78,7 +78,7 @@ en: QualificationRequest: Qualification assessed ReferenceRequest: Reference assessed stage_changed: Stage changed - state_changed: Status changed + status_changed: Status changed description: action_required_by_changed: Application requires %{action} action. assessor_assigned: "%{assignee_name} is assigned as the assessor." @@ -106,7 +106,7 @@ en: QualificationRequest: A qualification has been assessed. ReferenceRequest: A reference has been assessed. stage_changed: Stage changed from %{old_stage} to %{new_stage}. - state_changed: Status changed from %{old_state} to %{new_state}. + status_changed: Status changed from %{old_status} to %{new_status}. columns: contact_email: Reference email address contact_job: Reference job diff --git a/spec/components/timeline_entry_spec.rb b/spec/components/timeline_entry_spec.rb index 1f7fbac0ef..ca15df74d4 100644 --- a/spec/components/timeline_entry_spec.rb +++ b/spec/components/timeline_entry_spec.rb @@ -50,7 +50,7 @@ let(:timeline_event) do create( :timeline_event, - :state_changed, + :status_changed, old_value: "submitted", new_value: "awarded", ) diff --git a/spec/models/timeline_event_spec.rb b/spec/models/timeline_event_spec.rb index b409028d2f..a66160619c 100644 --- a/spec/models/timeline_event_spec.rb +++ b/spec/models/timeline_event_spec.rb @@ -90,7 +90,7 @@ requestable_requested: "requestable_requested", reviewer_assigned: "reviewer_assigned", stage_changed: "stage_changed", - state_changed: "state_changed", + status_changed: "status_changed", ).backed_by_column_of_type(:string) end @@ -136,8 +136,8 @@ it { is_expected.to validate_absence_of(:new_value) } end - context "with a state changed event type" do - before { timeline_event.event_type = :state_changed } + context "with a status changed event type" do + before { timeline_event.event_type = :status_changed } it { is_expected.to validate_absence_of(:assignee) } it { is_expected.to validate_absence_of(:assessment_section) }