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

last_three_comments_decorator.rb « presenters « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9812d11d57988d39cf39ccf2175bb0cba7457b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

class LastThreeCommentsDecorator
  def initialize(presenter)
    @presenter = presenter
  end

  def as_json(options={})
    @presenter.as_json.tap do |post|
      post[:interactions].merge!(:comments => CommentPresenter.as_collection(@presenter.post.last_three_comments))
    end
  end
end