diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index 9200f84b7..b037c63c4 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -87,10 +87,6 @@ module EventsHelper "#{h event_creator_name(event) } closed #{h title }".html_safe when "card_reopened" "#{h event_creator_name(event) } reopened #{h title }".html_safe - when "card_staged" - "#{h event_creator_name(event)} moved #{h title } to the #{h event.stage_name} stage".html_safe - when "card_unstaged" - "#{h event_creator_name(event)} moved #{h title } out ofthe #{h event.stage_name} stage".html_safe when "card_due_date_added" "#{h event_creator_name(event)} set the date to #{h event.particulars.dig('particulars', 'due_date').to_date.strftime('%B %-d')} on #{h title }".html_safe when "card_due_date_changed" @@ -110,10 +106,6 @@ module EventsHelper "assigned" when "card_unassigned" "minus" - when "card_staged" - "bolt" - when "card_unstaged" - "bolt" when "comment_created" "comment" when "card_title_changed" diff --git a/app/helpers/webhooks_helper.rb b/app/helpers/webhooks_helper.rb index 7fe91d8c0..dfb61c922 100644 --- a/app/helpers/webhooks_helper.rb +++ b/app/helpers/webhooks_helper.rb @@ -8,7 +8,6 @@ module WebhooksHelper card_due_date_removed: "Card due date removed", card_published: "Card published", card_reopened: "Card reopened", - card_staged: "Card staged", card_title_changed: "Card title changed", card_unassigned: "Card unassigned", card_unstaged: "Card unstaged", diff --git a/app/models/ai/list_cards_tool.rb b/app/models/ai/list_cards_tool.rb index a32456ddf..fd969666e 100644 --- a/app/models/ai/list_cards_tool.rb +++ b/app/models/ai/list_cards_tool.rb @@ -72,7 +72,7 @@ class Ai::ListCardsTool < Ai::Tool .where(collection: user.collections) .published .with_rich_text_description - .includes(:stage, :creator, :assignees, :goldness, :collection) + .includes(:column, :creator, :assignees, :goldness, :collection) cards = Filter.new(scope: cards, filters: params).filter @@ -98,7 +98,7 @@ class Ai::ListCardsTool < Ai::Tool last_active_at: card.last_active_at, collection_id: card.collection_id, golden: card.golden?, - stage: card.stage.as_json(only: [ :id, :name ]), + column: card.column.as_json(only: [ :id, :name ]), creator: card.creator.as_json(only: [ :id, :name ]), assignees: card.assignees.as_json(only: [ :id, :name ]), description: card.description.to_plain_text.truncate(1000), diff --git a/app/models/card.rb b/app/models/card.rb index a40c0ad90..2368d10ed 100644 --- a/app/models/card.rb +++ b/app/models/card.rb @@ -1,7 +1,7 @@ class Card < ApplicationRecord include Assignable, Attachments, Cacheable, Closeable, Colored, Entropic, Eventable, Golden, Mentions, Multistep, Pinnable, Postponable, Promptable, Readable, Searchable, - Staged, Stallable, Statuses, Taggable, Triageable, Watchable + Stallable, Statuses, Taggable, Triageable, Watchable belongs_to :collection, touch: true belongs_to :creator, class_name: "User", default: -> { Current.user } diff --git a/app/models/card/cacheable.rb b/app/models/card/cacheable.rb index 94c6b6d11..c0aac0dd5 100644 --- a/app/models/card/cacheable.rb +++ b/app/models/card/cacheable.rb @@ -17,11 +17,11 @@ module Card::Cacheable end def for_perma(*other) - [ card, Workflow.all, User.all, Tag.all, *other ] + [ card, User.all, Tag.all, *other ] end def for_preview(*other) - [ card, card.workflow, Workflow.all, card.collection.entropy_configuration, card.collection.publication, *other ] + [ card, card.collection.entropy_configuration, card.collection.publication, *other ] end end end diff --git a/app/models/card/eventable/system_commenter.rb b/app/models/card/eventable/system_commenter.rb index b633b45e7..65a6b8a36 100644 --- a/app/models/card/eventable/system_commenter.rb +++ b/app/models/card/eventable/system_commenter.rb @@ -18,8 +18,6 @@ class Card::Eventable::SystemCommenter "#{event.creator.name} assigned this to #{event.assignees.pluck(:name).to_sentence}." when "card_unassigned" "#{event.creator.name} unassigned from #{event.assignees.pluck(:name).to_sentence}." - when "card_staged" - "#{event.creator.name} moved this to ‘#{event.stage_name}’." when "card_closed" "Closed as ‘#{ card.closure.reason }’ by #{ event.creator.name }" when "card_reopened" diff --git a/app/models/card/staged.rb b/app/models/card/staged.rb deleted file mode 100644 index 4cd497abd..000000000 --- a/app/models/card/staged.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Card::Staged - extend ActiveSupport::Concern - - included do - belongs_to :stage, class_name: "Workflow::Stage", optional: true - - before_create :assign_initial_stage - - scope :in_stage, ->(stage) { where stage: stage } - delegate :workflow, to: :collection, allow_nil: true - end - - def staged? - stage.present? - end - - def change_stage_to(new_stage) - transaction do - update! stage: new_stage - track_event :staged, stage_id: new_stage.id, stage_name: new_stage.name - end - end - - private - def assign_initial_stage - self.stage = collection.initial_workflow_stage - end -end diff --git a/app/models/collection.rb b/app/models/collection.rb index bd4d403c7..7ccb34806 100644 --- a/app/models/collection.rb +++ b/app/models/collection.rb @@ -1,5 +1,5 @@ class Collection < ApplicationRecord - include AutoClosing, Accessible, Broadcastable, Entropic, Filterable, Publishable, Triageable, Workflowing + include AutoClosing, Accessible, Broadcastable, Entropic, Filterable, Publishable, Triageable belongs_to :creator, class_name: "User", default: -> { Current.user } diff --git a/app/models/collection/workflowing.rb b/app/models/collection/workflowing.rb deleted file mode 100644 index 0a14cad36..000000000 --- a/app/models/collection/workflowing.rb +++ /dev/null @@ -1,18 +0,0 @@ -module Collection::Workflowing - extend ActiveSupport::Concern - - included do - belongs_to :workflow, optional: true - - after_update_commit :set_all_cards_to_initial_workflow_stage, if: :saved_change_to_workflow_id? - end - - def initial_workflow_stage - workflow&.stages&.first - end - - private - def set_all_cards_to_initial_workflow_stage - cards.update_all(stage_id: initial_workflow_stage&.id, updated_at: Time.current) - end -end diff --git a/app/models/event/particulars.rb b/app/models/event/particulars.rb index dd92fa4da..31ecd66bf 100644 --- a/app/models/event/particulars.rb +++ b/app/models/event/particulars.rb @@ -2,7 +2,7 @@ module Event::Particulars extend ActiveSupport::Concern included do - store_accessor :particulars, :assignee_ids, :stage_id, :stage_name + store_accessor :particulars, :assignee_ids end def assignees diff --git a/app/models/filter/params.rb b/app/models/filter/params.rb index 6992516f5..166436e4b 100644 --- a/app/models/filter/params.rb +++ b/app/models/filter/params.rb @@ -12,7 +12,6 @@ module Filter::Params creator_ids: [], closer_ids: [], collection_ids: [], - stage_ids: [], tag_ids: [], terms: [] ] diff --git a/app/models/user/day_timeline.rb b/app/models/user/day_timeline.rb index 80eb8a95d..cf8d08612 100644 --- a/app/models/user/day_timeline.rb +++ b/app/models/user/day_timeline.rb @@ -46,7 +46,7 @@ class User::DayTimeline end def cache_key - ActiveSupport::Cache.expand_cache_key [ user, filter, day.to_date, events, Workflow.all, weekly_highlights ], "day-timeline" + ActiveSupport::Cache.expand_cache_key [ user, filter, day.to_date, events, weekly_highlights ], "day-timeline" end private diff --git a/app/models/webhook.rb b/app/models/webhook.rb index 1eefb2cb5..a766e68f5 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -15,7 +15,6 @@ class Webhook < ApplicationRecord card_due_date_removed card_published card_reopened - card_staged card_title_changed card_unassigned card_unstaged diff --git a/app/models/workflow.rb b/app/models/workflow.rb deleted file mode 100644 index 196af1cc3..000000000 --- a/app/models/workflow.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Workflow < ApplicationRecord - DEFAULT_STAGES = [ - { name: "Figuring it out", color: "var(--color-card-5)" }, - { name: "In progress", color: "var(--color-card-3)" } - ] - - has_many :stages, dependent: :destroy - has_many :collections, dependent: :nullify - - after_create_commit :create_default_columns - - private - def create_default_stages - Workflow::Stage.insert_all(DEFAULT_STAGES.map { { name: it[:name], color: it[:color], workflow_id: id } }) - end -end diff --git a/app/models/workflow/stage.rb b/app/models/workflow/stage.rb deleted file mode 100644 index 4eb08828d..000000000 --- a/app/models/workflow/stage.rb +++ /dev/null @@ -1,12 +0,0 @@ -class Workflow::Stage < ApplicationRecord - belongs_to :workflow, touch: true - - has_many :cards, dependent: :nullify - - before_validation :assign_random_color, on: :create - - private - def assign_random_color - self.color ||= Card::Colored::COLORS.sample - end -end diff --git a/app/views/cards/_card.json.jbuilder b/app/views/cards/_card.json.jbuilder index fdb242edd..15926a921 100644 --- a/app/views/cards/_card.json.jbuilder +++ b/app/views/cards/_card.json.jbuilder @@ -12,9 +12,9 @@ json.cache! card do json.partial! "collections/collection", locals: { collection: card.collection } end - json.stage do - if card.stage - json.partial! "workflows/stages/stage", stage: card.stage + json.column do + if card.column + json.partial! "columns/column", column: card.column else nil end diff --git a/app/views/cards/display/public_preview/_columns.html.erb b/app/views/cards/display/public_preview/_columns.html.erb index 670767f24..459893b7f 100644 --- a/app/views/cards/display/public_preview/_columns.html.erb +++ b/app/views/cards/display/public_preview/_columns.html.erb @@ -1,4 +1,4 @@ -