diaspora/app/presenters/conversation_presenter.rb
2018-12-30 22:31:33 +01:00

17 lines
483 B
Ruby

class ConversationPresenter < BasePresenter
def initialize(conversation)
@conversation = conversation
end
def as_json
{
id: @conversation.id,
guid: @conversation.guid,
created_at: @conversation.created_at,
subject: @conversation.subject,
messages: @conversation.messages.map {|x| x.as_json["message"] },
author: @conversation.author,
participants: @conversation.participants
}
end
end