diaspora/app/presenters/conversation_presenter.rb
Frank Rousseau 454be1b468 Make conversation API data format ok with docs
* Base the API requesting on GUID instead of ID
* Include read field
* Do not include messages in conversation results
2018-11-01 13:56:18 +01:00

17 lines
481 B
Ruby

class ConversationPresenter < BasePresenter
def as_api_json
read =
@presentable.conversation_visibilities.length > 0 and
@presentable.conversation_visibilities[0].unread == 0
{
guid: @presentable.guid,
subject: @presentable.subject,
created_at: @presentable.created_at,
read: read,
participants: @presentable.participants.map {
|x| PersonPresenter.new(x).as_api_json
}
}
end
end