Sha256: 1925690d2354f945e6b591f6242aa250c0696a13d064ab548019d92c50998daa
Contents?: true
Size: 1.52 KB
Versions: 48
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # A command with all the business logic when updating a conference # speaker in the system. class UpdateMediaLink < Rectify::Command # Public: Initializes the command. # # form - A form object with the params. # media_link - The ConferenceSpeaker to update def initialize(form, media_link) @form = form @media_link = media_link 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 form.invalid? return broadcast(:invalid) unless media_link transaction do update_media_link! end broadcast(:ok) end private attr_reader :form, :media_link def update_media_link! log_info = { resource: { title: media_link.title }, participatory_space: { title: media_link.conference.title } } Decidim.traceability.update!( media_link, form.current_user, form.attributes.slice( :title, :link, :weight, :date ), log_info ) end end end end end
Version data entries
48 entries across 48 versions & 1 rubygems