Sha256: 5f3ac0680c25c0a4ae7a3c7ca86f64e8b5efa32b3d41dfc7837a371f5915a83f

Contents?: true

Size: 604 Bytes

Versions: 24

Compression:

Stored size: 604 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).find_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

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-4.7.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.6.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.6.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.5.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.4.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.6 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.5 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.4 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.3.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.2.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.1.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.1.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.1.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.0.3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.0.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.0.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-4.0.0 app/services/spotlight/invite_users_service.rb