Class: Decidim::Meetings::Admin::DestroyMeeting

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-meetings/app/commands/decidim/meetings/admin/destroy_meeting.rb

Overview

This command is executed when the user destroys a Meeting from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(meeting, current_user) ⇒ DestroyMeeting

Initializes a CloseMeeting Command.

meeting - The current instance of the page to be closed. current_user - the user performing the action


13
14
15
16
# File 'decidim-meetings/app/commands/decidim/meetings/admin/destroy_meeting.rb', line 13

def initialize(meeting, current_user)
  @meeting = meeting
  @current_user = current_user
end

Instance Method Details

#callObject

Destroys the meeting if valid.

Broadcasts :ok if successful, :invalid otherwise.


21
22
23
24
25
26
# File 'decidim-meetings/app/commands/decidim/meetings/admin/destroy_meeting.rb', line 21

def call
  return broadcast(:invalid, proposals.size) if proposals.any?

  destroy_meeting
  broadcast(:ok)
end