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

synthetic_state_notes_builder_service.rb « resource_events « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 71d4020036526fc2e8e3d12f1271b1968739219d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

module ResourceEvents
  class SyntheticStateNotesBuilderService < BaseSyntheticNotesBuilderService
    private

    def synthetic_notes
      state_change_events.map do |event|
        StateNote.from_event(event, resource: resource, resource_parent: resource_parent)
      end
    end

    def state_change_events
      return [] unless resource.respond_to?(:resource_state_events)

      events = resource.resource_state_events.includes(user: :status) # rubocop: disable CodeReuse/ActiveRecord
      apply_common_filters(events)
    end
  end
end