Sha256: 08e92ef71d1ff96ea8ded1ad8e417906f1d99c2bf685426cd633726bf46cfdb3
Contents?: true
Size: 1.28 KB
Versions: 46
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # A command with all the business logic to send diplomas to registered conference users. # class SendConferenceDiplomas < Rectify::Command # Public: Initializes the command. # # conference - The conference which the user is invited to. def initialize(conference, current_user) @conference = conference @current_user = current_user end # 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. def call return broadcast(:invalid) if conference.diploma_sent? send_diplomas broadcast(:ok) end private attr_reader :current_user, :conference def send_diplomas Decidim.traceability.perform_action!( :send_conference_diplomas, conference, current_user ) do SendConferenceDiplomaJob.perform_later(conference) conference.diploma_sent_at = Time.current conference.save! end end end end end end
Version data entries
46 entries across 46 versions & 1 rubygems