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

note_builder.rb « hook_data « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae30ef6364bd3b5627249eccde3d82534dc20693 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

module Gitlab
  module HookData
    class NoteBuilder < BaseBuilder
      SAFE_HOOK_ATTRIBUTES = %i[
        attachment
        author_id
        change_position
        commit_id
        created_at
        discussion_id
        id
        line_code
        note
        noteable_id
        noteable_type
        original_position
        position
        project_id
        resolved_at
        resolved_by_id
        resolved_by_push
        st_diff
        system
        type
        updated_at
        updated_by_id
      ].freeze

      alias_method :note, :object

      def build
        note
          .attributes
          .with_indifferent_access
          .slice(*SAFE_HOOK_ATTRIBUTES)
          .merge(
            description: absolute_image_urls(note.note),
            url: Gitlab::UrlBuilder.build(note)
          )
      end
    end
  end
end