Progress with DMs
Progress with DMs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::ChatConversationAccountSerializer < ActiveModel::Serializer
|
||||
attributes :id, :is_hidden, :is_approved, :is_unread, :chat_conversation_id, :created_at
|
||||
attributes :id, :is_hidden, :is_approved, :unread_count, :is_unread, :chat_conversation_id, :created_at
|
||||
|
||||
has_many :participant_accounts, key: :other_accounts, serializer: REST::AccountSerializer
|
||||
has_one :last_chat_message, serializer: REST::ChatMessageSerializer, unless: :last_chat_message_id?
|
||||
@@ -18,4 +18,8 @@ class REST::ChatConversationAccountSerializer < ActiveModel::Serializer
|
||||
object.last_chat_message_id.nil?
|
||||
end
|
||||
|
||||
def is_unread
|
||||
object.unread_count > 0
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -7,4 +7,13 @@ class REST::ChatMessageSerializer < ActiveModel::Serializer
|
||||
def id
|
||||
object.id.to_s
|
||||
end
|
||||
|
||||
def from_account_id
|
||||
object.from_account_id.to_s
|
||||
end
|
||||
|
||||
def chat_conversation_id
|
||||
object.chat_conversation_id.to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user