debian-mirror-gitlab/lib/gitlab/data_builder/wiki_page.rb

28 lines
672 B
Ruby
Raw Normal View History

2018-12-23 12:14:25 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
module Gitlab
module DataBuilder
module WikiPage
extend self
def build(wiki_page, user, action)
wiki = wiki_page.wiki
2020-05-24 23:13:21 +05:30
# TODO: group hooks https://gitlab.com/gitlab-org/gitlab/-/issues/216904
return {} if wiki.container.is_a?(Group)
2017-09-10 17:25:29 +05:30
{
object_kind: wiki_page.class.name.underscore,
user: user.hook_attrs,
project: wiki.project.hook_attrs,
wiki: wiki.hook_attrs,
object_attributes: wiki_page.hook_attrs.merge(
url: Gitlab::UrlBuilder.build(wiki_page),
action: action
)
}
end
end
end
end