summaryrefslogtreecommitdiff
path: root/app/services/events/render_service.rb
blob: 0b62d8aedf110fc3afbb4ced7c8216dc5dbebe9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Events
  class RenderService < BaseRenderer
    def execute(events, atom_request: false)
      events.map(&:note).compact.group_by(&:project).each do |project, notes|
        render_notes(notes, project, atom_request)
      end
    end

    private

    def render_notes(notes, project, atom_request)
      Notes::RenderService.new(current_user).execute(notes, project, render_options(atom_request))
    end

    def render_options(atom_request)
      return {} unless atom_request

      { only_path: false, xhtml: true }
    end
  end
end