Class: Decidim::Conferences::Admin::SendConferenceDiplomas

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

Overview

A command with all the business logic to send diplomas to registered conference users.

Instance Method Summary collapse

Constructor Details

#initialize(conference, current_user) ⇒ SendConferenceDiplomas

Public: Initializes the command.

conference - The conference which the user is invited to.


12
13
14
15
# File 'decidim-conferences/app/commands/decidim/conferences/admin/send_conference_diplomas.rb', line 12

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

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form wasn't valid and we couldn't proceed.

Returns nothing.


23
24
25
26
27
28
# File 'decidim-conferences/app/commands/decidim/conferences/admin/send_conference_diplomas.rb', line 23

def call
  return broadcast(:invalid) if conference.diploma_sent?

  send_diplomas
  broadcast(:ok)
end