group unread count

This commit is contained in:
2458773093
2019-07-20 02:04:08 +03:00
parent a6f09dc0c7
commit c5c2585239
3 changed files with 24 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
# frozen_string_literal: true
class REST::GroupRelationshipSerializer < ActiveModel::Serializer
attributes :id, :member, :admin
attributes :id, :member, :admin, :unread_count
def id
object.id.to_s
@@ -14,4 +14,8 @@ class REST::GroupRelationshipSerializer < ActiveModel::Serializer
def admin
instance_options[:relationships].admin[object.id] ? true : false
end
def unread_count
instance_options[:relationships].unread_count[object.id] || 0
end
end