Sha256: c01d03449733e7d03c2ef42f28717976fb6f001ea0ab9865fb3e092db140d084

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

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

      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: privatable_to)
                                                             .with_context(
                                                               current_user: current_user,
                                                               current_particiaptory_space: privatable_to
                                                             )

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-admin-0.24.3 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.24.2 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.24.1 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.24.0 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.24.0.rc2 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb
decidim-admin-0.24.0.rc1 app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb