Sha256: 93f65ee31f53b7ffd4940c89dad371a4404fd850aad1540aeb0bb90f0324b39d
Contents?: true
Size: 1 KB
Versions: 13
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module Decidim module Proposals module Admin # A command with all the business logic related with an admin discarding participatory text proposals. class DiscardParticipatoryText < Decidim::Command # Public: Initializes the command. # # form - A PreviewParticipatoryTextForm form object with the params. def initialize(component) @component = component 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 transaction do discard_drafts end broadcast(:ok) end private attr_reader :form def discard_drafts proposals = Decidim::Proposals::Proposal.drafts.where(component: @component) proposals.destroy_all end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems