Sha256: 884f5b03ead0301afd2e482cb911396902a710d24854f427c6d0807162d1342f

Contents?: true

Size: 1 KB

Versions: 31

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    module Admin
      # This command is executed when the user destroys a Meeting from the admin
      # panel.
      class DestroyMeeting < Rectify::Command
        # Initializes a CloseMeeting Command.
        #
        # meeting - The current instance of the page to be closed.
        # current_user - the user performing the action
        def initialize(meeting, current_user)
          @meeting = meeting
          @current_user = current_user
        end

        # Destroys the meeting if valid.
        #
        # Broadcasts :ok if successful, :invalid otherwise.
        def call
          destroy_meeting

          broadcast(:ok)
        end

        private

        attr_reader :current_user, :meeting

        def destroy_meeting
          Decidim.traceability.perform_action!(
            :delete,
            meeting,
            current_user
          ) do
            meeting.destroy!
          end
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-meetings-0.21.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.20.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.20.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.19.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.18.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.19.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.17.2 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.18.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.17.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.16.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.17.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.16.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.15.2 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.15.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.15.0 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.14.4 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.14.3 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.14.2 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.14.1 app/commands/decidim/meetings/admin/destroy_meeting.rb
decidim-meetings-0.13.1 app/commands/decidim/meetings/admin/destroy_meeting.rb