Sha256: 6585db8a15bb2b80a5ad58499a15c0547f56ea0ecf70d2366064d13c6798edc9

Contents?: true

Size: 879 Bytes

Versions: 46

Compression:

Stored size: 879 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # This command deals with destroying a StaticPageTopic from the admin panel.
    class DestroyStaticPageTopic < Rectify::Command
      # Public: Initializes the command.
      #
      # page - The StaticPageTopic to be destroyed.
      def initialize(_topic, current_user)
        @topic = page
        @current_user = current_user
      end

      # Public: Executes the command.
      #
      # Broadcasts :ok if it got destroyed
      def call
        destroy_topic
        broadcast(:ok)
      end

      private

      attr_reader :page, :current_user

      def destroy_page
        transaction do
          Decidim.traceability.perform_action!(
            "delete",
            topic,
            current_user
          ) do
            topic.destroy!
          end
        end
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
decidim-admin-0.26.10 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.9 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.8 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.7 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.5 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.4 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.3 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.2 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.1 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.0 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.0.rc2 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.26.0.rc1 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.2 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.1 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.0 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.0.rc4 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.0.rc3 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.0.rc2 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.25.0.rc1 app/commands/decidim/admin/destroy_static_page_topic.rb
decidim-admin-0.24.3 app/commands/decidim/admin/destroy_static_page_topic.rb