Class: Members::AcceptInviteService

Inherits:
BaseService show all
Defined in:
app/services/members/accept_invite_service.rb

Constant Summary

Constants inherited from BaseService

BaseService::UnauthorizedError

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods inherited from BaseService

#after_execute

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?, #can_all?, #can_any?

Constructor Details

#initializeAcceptInviteService

Returns a new instance of AcceptInviteService.



5
6
7
8
9
# File 'app/services/members/accept_invite_service.rb', line 5

def initialize(...)
  super

  @member = @params[:member]
end

Instance Method Details

#executeObject



11
12
13
14
15
16
# File 'app/services/members/accept_invite_service.rb', line 11

def execute
  return ServiceResponse.error(message: _("The invitation could not be accepted.")) unless accept_invite!

  publish_accepted_invite_event
  ServiceResponse.success
end