Welcome to mirror list, hosted at ThFree Co, Russian Federation.

update_service.rb « wiki_pages « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ac6902e0b0191a04471015d205d261c4058d17f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module WikiPages
  class UpdateService < WikiPages::BaseService
    def execute(page)
      # this class is not thread safe!
      @old_slug = page.slug

      if page.update(@params)
        execute_hooks(page)
      end

      page
    end

    def usage_counter_action
      :update
    end

    def external_action
      'update'
    end

    def event_action
      :updated
    end

    def slug_for_page(page)
      @old_slug.presence || super
    end
  end
end