Class: Decidim::Meetings::CloseMeeting

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

Overview

This command is executed when the user closes a Meeting from the public views.

Instance Method Summary collapse

Constructor Details

#initialize(form, meeting) ⇒ CloseMeeting

Initializes a CloseMeeting Command.

form - The form from which to get the data. meeting - The current instance of the page to be closed.


12
13
14
15
# File 'decidim-meetings/app/commands/decidim/meetings/close_meeting.rb', line 12

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

Instance Method Details

#callObject

Closes the meeting if valid.

Broadcasts :ok if successful, :invalid otherwise.


20
21
22
23
24
25
26
27
28
29
# File 'decidim-meetings/app/commands/decidim/meetings/close_meeting.rb', line 20

def call
  return broadcast(:invalid) if form.invalid?

  transaction do
    close_meeting
    link_proposals
  end

  broadcast(:ok)
end