Sha256: 30d7a5886cabf66068fc2e87141aa8d0c3a1c6972f71275c292355d33e074765

Contents?: true

Size: 599 Bytes

Versions: 57

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # A simple service to invite any users who where created by an invitation but it was never sent.
  # This is done because the associated information between the resource, the role, and the user
  # need to be persisted in order to generate the appropriate content in the invitation email.
  class InviteUsersService
    def self.call(resource:)
      resource.roles.includes(:user).each do |role|
        user = role.user

        user.deliver_invitation if user.created_by_invite? && user.invitation_sent_at.blank?
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
blacklight-spotlight-3.5.0.4 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.5.0.3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.6.0.beta6 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.6.0.beta5 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.6.0.beta4 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.6.0.beta3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.6.0.beta1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.5.0.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.5.0.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.5.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.4.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.4 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.2.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.2.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.4.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.3.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-3.2.0 app/services/spotlight/invite_users_service.rb