Class: WikiPages::DestroyService

Inherits:
BaseService show all
Defined in:
app/services/wiki_pages/destroy_service.rb

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #params

Instance Method Summary collapse

Methods inherited from BaseContainerService

#initialize

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

This class inherits a constructor from BaseContainerService

Instance Method Details

#event_actionObject


24
25
26
# File 'app/services/wiki_pages/destroy_service.rb', line 24

def event_action
  :destroyed
end

#execute(page) ⇒ Object


5
6
7
8
9
10
11
12
13
14
# File 'app/services/wiki_pages/destroy_service.rb', line 5

def execute(page)
  if page.delete
    execute_hooks(page)
    ServiceResponse.success(payload: { page: page })
  else
    ServiceResponse.error(
      message: _('Could not delete wiki page'), payload: { page: page }
    )
  end
end

#external_actionObject


20
21
22
# File 'app/services/wiki_pages/destroy_service.rb', line 20

def external_action
  'delete'
end

#fingerprint(page) ⇒ Object


28
29
30
# File 'app/services/wiki_pages/destroy_service.rb', line 28

def fingerprint(page)
  page.wiki.repository.head_commit.sha
end

#usage_counter_actionObject


16
17
18
# File 'app/services/wiki_pages/destroy_service.rb', line 16

def usage_counter_action
  :delete
end