Class: Users::UnblockService

Inherits:
BaseService show all
Defined in:
app/services/users/unblock_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

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?

Constructor Details

#initialize(current_user) ⇒ UnblockService

Returns a new instance of UnblockService.



5
6
7
# File 'app/services/users/unblock_service.rb', line 5

def initialize(current_user)
  @current_user = current_user
end

Instance Method Details

#execute(user) ⇒ Object



9
10
11
12
13
14
15
16
# File 'app/services/users/unblock_service.rb', line 9

def execute(user)
  if user.activate
    after_unblock_hook(user)
    ServiceResponse.success(payload: { user: user })
  else
    ServiceResponse.error(message: user.errors.full_messages)
  end
end