2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Events
|
|
|
|
class RenderService < BaseRenderer
|
|
|
|
def execute(events, atom_request: false)
|
2018-05-09 12:01:36 +05:30
|
|
|
notes = events.map(&:note).compact
|
|
|
|
|
|
|
|
render_notes(notes, atom_request)
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
def render_notes(notes, atom_request)
|
|
|
|
Notes::RenderService
|
|
|
|
.new(current_user)
|
|
|
|
.execute(notes, render_options(atom_request))
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def render_options(atom_request)
|
|
|
|
return {} unless atom_request
|
|
|
|
|
|
|
|
{ only_path: false, xhtml: true }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|