Sha256: d06a7d51bcdc23c2dd7972bd7196e16ed139910a7430b8eee133ff7280eedb96

Contents?: true

Size: 645 Bytes

Versions: 6

Compression:

Stored size: 645 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    module Admin
      # A command that deletes a participatory process step
      class DestroyParticipatoryProcessStep < Decidim::Commands::DestroyResource
        private

        def participatory_process = resource.participatory_space

        def invalid?
          participatory_process.steps.count > 1 && resource.active?
        end

        def run_after_hooks
          steps = participatory_process.steps.reload

          ReorderParticipatoryProcessSteps
            .new(steps, steps.map(&:id))
            .call
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.29.1 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
decidim-participatory_processes-0.29.0 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
decidim-participatory_processes-0.29.0.rc4 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
decidim-participatory_processes-0.29.0.rc3 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
decidim-participatory_processes-0.29.0.rc2 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb
decidim-participatory_processes-0.29.0.rc1 app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb