Sha256: a2354c4d085cd190db6b379fe4ac9cfa55fc331abf238ed73dd71319f5aaf4ac

Contents?: true

Size: 691 Bytes

Versions: 19

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    class UpdateExternalDomainWhitelist < Rectify::Command
      attr_reader :form, :organization

      def initialize(form, organization)
        @form = form
        @organization = organization
      end

      def call
        return broadcast(:invalid) if form.invalid?

        save_domains!

        broadcast(:ok)
      end

      private

      def save_domains!
        organization.external_domain_whitelist = form.external_domains.filter_map do |external_domain_form|
          external_domain_form.value unless external_domain_form.deleted
        end.flatten

        organization.save!
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-admin-0.26.10 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.9 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.8 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.7 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.5 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.4 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.3 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.2 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.1 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.0 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.0.rc2 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.26.0.rc1 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.2 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.1 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.0 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.0.rc4 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.0.rc3 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.0.rc2 app/commands/decidim/admin/update_external_domain_whitelist.rb
decidim-admin-0.25.0.rc1 app/commands/decidim/admin/update_external_domain_whitelist.rb