Class: Gitlab::HookData::NoteBuilder

Inherits:
BaseBuilder show all
Defined in:
lib/gitlab/hook_data/note_builder.rb

Constant Summary collapse

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

Constants inherited from BaseBuilder

BaseBuilder::MARKDOWN_SIMPLE_IMAGE

Instance Attribute Summary

Attributes inherited from BaseBuilder

#object

Instance Method Summary collapse

Methods inherited from BaseBuilder

#initialize

Constructor Details

This class inherits a constructor from Gitlab::HookData::BaseBuilder

Instance Method Details

#buildObject


33
34
35
36
37
38
39
40
41
42
# File 'lib/gitlab/hook_data/note_builder.rb', line 33

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