Class: SavedReplies::DestroyService

Inherits:
BaseService show all
Defined in:
app/services/saved_replies/destroy_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 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

#initialize(saved_reply:) ⇒ DestroyService

Returns a new instance of DestroyService.



5
6
7
# File 'app/services/saved_replies/destroy_service.rb', line 5

def initialize(saved_reply:)
  @saved_reply = saved_reply
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
# File 'app/services/saved_replies/destroy_service.rb', line 9

def execute
  if saved_reply.destroy
    success(saved_reply: saved_reply)
  else
    error(saved_reply.errors.full_messages)
  end
end