Class: ResourceEvents::MergeIntoNotesService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/resource_events/merge_into_notes_service.rb

Constant Summary collapse

SYNTHETIC_NOTE_BUILDER_SERVICES =
[
  SyntheticLabelNotesBuilderService,
  SyntheticMilestoneNotesBuilderService,
  SyntheticStateNotesBuilderService
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(resource, current_user, params = {}) ⇒ MergeIntoNotesService

Returns a new instance of MergeIntoNotesService.


20
21
22
23
24
# File 'app/services/resource_events/merge_into_notes_service.rb', line 20

def initialize(resource, current_user, params = {})
  @resource = resource
  @current_user = current_user
  @params = params
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user


18
19
20
# File 'app/services/resource_events/merge_into_notes_service.rb', line 18

def current_user
  @current_user
end

#paramsObject (readonly)

Returns the value of attribute params


18
19
20
# File 'app/services/resource_events/merge_into_notes_service.rb', line 18

def params
  @params
end

#resourceObject (readonly)

Returns the value of attribute resource


18
19
20
# File 'app/services/resource_events/merge_into_notes_service.rb', line 18

def resource
  @resource
end

Instance Method Details

#execute(notes = []) ⇒ Object


26
27
28
# File 'app/services/resource_events/merge_into_notes_service.rb', line 26

def execute(notes = [])
  (notes + synthetic_notes).sort_by(&:created_at)
end