Sha256: 05b818daf90e2f2f661cb3ca6fa3c507b7ba90fd8470f9a219cb6e46cf5055a6
Contents?: true
Size: 1.36 KB
Versions: 12
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # A command with all the business logic when destroying a media link # in the system. class DestroyMediaLink < Decidim::Command # Public: Initializes the command. # # media_link - the MediaLink to destroy # current_user - the user performing this action def initialize(media_link, current_user) @media_link = media_link @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 destroy_speaker! broadcast(:ok) end private attr_reader :media_link, :current_user def destroy_speaker! log_info = { resource: { title: media_link.title }, participatory_space: { title: media_link.conference.title } } Decidim.traceability.perform_action!( "delete", media_link, current_user, log_info ) do media_link.destroy! media_link end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems