Sha256: 749a54945b8c874919b7fc0d9823d42f1e2c3417b60845f9cd4f5ff462ceecaa

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module Proposals
      ##
      # Decorate create_collaborative_draft to avoid
      # private data to be in PaperTrail
      module CreateCollaborativeDraftOverride
        extend ActiveSupport::Concern

        included do
          private

          alias_method :decidim_original_create_collaborative_draft, :create_collaborative_draft

          def create_collaborative_draft
            created_draft = decidim_original_create_collaborative_draft
            # Update the proposal with the private body, to
            # avoid tracebility on private fields.
            created_draft.update_private_body!(form.private_body) if form.private_body.present?
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.10.3 app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb
decidim-decidim_awesome-0.11.2 app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb
decidim-decidim_awesome-0.11.1 app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb