2018-07-18 12:03:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-20 08:32:43 -05:00
|
|
|
module WikiPages
|
|
|
|
class DestroyService < WikiPages::BaseService
|
|
|
|
def execute(page)
|
2020-08-20 23:10:16 -04:00
|
|
|
if page.delete
|
2020-03-24 08:09:42 -04:00
|
|
|
execute_hooks(page)
|
2020-08-20 23:10:16 -04:00
|
|
|
ServiceResponse.success(payload: { page: page })
|
|
|
|
else
|
|
|
|
ServiceResponse.error(
|
|
|
|
message: _('Could not delete wiki page'), payload: { page: page }
|
|
|
|
)
|
2016-12-20 08:32:43 -05:00
|
|
|
end
|
|
|
|
end
|
2020-03-24 08:09:42 -04:00
|
|
|
|
|
|
|
def usage_counter_action
|
|
|
|
:delete
|
|
|
|
end
|
|
|
|
|
|
|
|
def external_action
|
|
|
|
'delete'
|
|
|
|
end
|
|
|
|
|
|
|
|
def event_action
|
2020-05-28 11:08:02 -04:00
|
|
|
:destroyed
|
2020-03-24 08:09:42 -04:00
|
|
|
end
|
2020-07-20 08:09:34 -04:00
|
|
|
|
|
|
|
def fingerprint(page)
|
|
|
|
page.wiki.repository.head_commit.sha
|
|
|
|
end
|
2016-12-20 08:32:43 -05:00
|
|
|
end
|
|
|
|
end
|