Sha256: 529ba26b695b5a9f318c0acf515dc892f2fbbe24f9a1f11378a7de7a26ffabe5

Contents?: true

Size: 581 Bytes

Versions: 4

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ActionDelegator
    class SyncParticipantsJob < ApplicationJob
      queue_as :default

      def perform(setting)
        @setting = setting

        return unless setting&.participants

        setting.participants.each do |participant|
          next if participant.decidim_user.present?
          next if participant.user_from_metadata.blank?

          participant.decidim_user = participant.user_from_metadata
          participant.save
        end
      end

      private

      attr_reader :setting
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
decidim-action_delegator-0.8.1 app/jobs/decidim/action_delegator/sync_participants_job.rb
decidim-action_delegator-0.7.2 app/jobs/decidim/action_delegator/sync_participants_job.rb
decidim-action_delegator-0.7.1 app/jobs/decidim/action_delegator/sync_participants_job.rb
decidim-action_delegator-0.7.0 app/jobs/decidim/action_delegator/sync_participants_job.rb