2018-07-16 12:31:01 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-11-06 11:52:56 -05:00
|
|
|
module Events
|
|
|
|
class RenderService < BaseRenderer
|
|
|
|
def execute(events, atom_request: false)
|
2018-04-03 09:45:17 -04:00
|
|
|
notes = events.map(&:note).compact
|
|
|
|
|
|
|
|
render_notes(notes, atom_request)
|
2017-11-06 11:52:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-04-03 09:45:17 -04:00
|
|
|
def render_notes(notes, atom_request)
|
|
|
|
Notes::RenderService
|
|
|
|
.new(current_user)
|
|
|
|
.execute(notes, render_options(atom_request))
|
2017-11-06 11:52:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def render_options(atom_request)
|
|
|
|
return {} unless atom_request
|
|
|
|
|
|
|
|
{ only_path: false, xhtml: true }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|