gab-social/app/serializers/rest/group_relationship_serializer.rb
mgabdev 217aab9faa Added join requests to Groups
• Added:
- join requests to Groups
- redux actions, reducers
- controller and functionality for fetching join requests, accepting, rejecting join requests
2020-09-10 17:07:00 -05:00

27 lines
565 B
Ruby

# frozen_string_literal: true
class REST::GroupRelationshipSerializer < ActiveModel::Serializer
attributes :id, :member, :admin, :moderator, :requested
def id
object.id.to_s
end
def member
instance_options[:relationships].member[object.id] ? true : false
end
def admin
instance_options[:relationships].admin[object.id] ? true : false
end
def moderator
instance_options[:relationships].moderator[object.id] ? true : false
end
def requested
instance_options[:relationships].requested[object.id] ? true : false
end
end