Sha256: 7257e0b85dc4f8323beae4328b933baf018c4dd71dc08b95e325df19aed29f0a
Contents?: true
Size: 1.54 KB
Versions: 7
Compression:
Stored size: 1.54 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 < Decidim::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 was not valid and we could not 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" ).symbolize_keys, log_info ) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems