2020-06-23 00:09:42 +05:30
|
|
|
# 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
|
2020-07-28 23:09:34 +05:30
|
|
|
apply_common_filters(events)
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|