Class: Spotlight::InviteUsersService

Inherits:
Object
  • Object
show all
Defined in:
app/services/spotlight/invite_users_service.rb

Overview

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 Method Summary collapse

Class Method Details

.call(resource:) ⇒ Object



7
8
9
10
11
12
13
# File 'app/services/spotlight/invite_users_service.rb', line 7

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