Sha256: 374c36faf0ee0628d5c197408eccb9150ec02bafcb36db995e30ac8156ac6b68

Contents?: true

Size: 991 Bytes

Versions: 6

Compression:

Stored size: 991 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Custom ApplicationJob scoped to the admin panel.
    #
    class ImportParticipatorySpacePrivateUserCsvJob < ApplicationJob
      queue_as :exports

      def perform(email, user_name, privatable_to, current_user)
        return if email.blank? || user_name.blank?

        params = {
          name: user_name,
          email: email.downcase.strip
        }
        private_user_form = ParticipatorySpacePrivateUserForm.from_params(params, privatable_to:)
                                                             .with_context(
                                                               current_user:,
                                                               current_participatory_space: privatable_to
                                                             )

        Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, privatable_to, via_csv: true)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.29.1 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.29.0 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.29.0.rc4 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.29.0.rc3 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.29.0.rc2 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.29.0.rc1 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb