debian-mirror-gitlab/app/services/wiki_pages/update_service.rb

33 lines
505 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2016-06-02 11:05:42 +05:30
module WikiPages
class UpdateService < WikiPages::BaseService
def execute(page)
2020-04-22 19:07:51 +05:30
# this class is not thread safe!
@old_slug = page.slug
2017-09-10 17:25:29 +05:30
if page.update(@params)
2020-04-22 19:07:51 +05:30
execute_hooks(page)
2016-06-02 11:05:42 +05:30
end
page
end
2020-04-22 19:07:51 +05:30
def usage_counter_action
:update
end
def external_action
'update'
end
def event_action
Event::UPDATED
end
def slug_for_page(page)
@old_slug.presence || super
end
2016-06-02 11:05:42 +05:30
end
end