2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
module WikiPages
|
|
|
|
class DestroyService < WikiPages::BaseService
|
|
|
|
def execute(page)
|
2020-11-24 15:15:51 +05:30
|
|
|
if page.delete
|
2020-04-22 19:07:51 +05:30
|
|
|
execute_hooks(page)
|
2020-11-24 15:15:51 +05:30
|
|
|
ServiceResponse.success(payload: { page: page })
|
|
|
|
else
|
|
|
|
ServiceResponse.error(
|
|
|
|
message: _('Could not delete wiki page'), payload: { page: page }
|
|
|
|
)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
def usage_counter_action
|
|
|
|
:delete
|
|
|
|
end
|
|
|
|
|
|
|
|
def external_action
|
|
|
|
'delete'
|
|
|
|
end
|
|
|
|
|
|
|
|
def event_action
|
2020-06-23 00:09:42 +05:30
|
|
|
:destroyed
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
def fingerprint(page)
|
|
|
|
page.wiki.repository.head_commit.sha
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|