Sha256: c9aff86eff15a842e3caf53abc36ac8408c602f70c77fa3bc8585e6d952a7481

Contents?: true

Size: 568 Bytes

Versions: 23

Compression:

Stored size: 568 Bytes

Contents

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

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.4.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.3.3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.3.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.3.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.3.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.2.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.2.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.1.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc6 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc5 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc4 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc3 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc2 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-2.0.0.rc1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-1.5.1 app/services/spotlight/invite_users_service.rb
blacklight-spotlight-1.4.1 app/services/spotlight/invite_users_service.rb