discourse/app/serializers/invite_serializer.rb

22 lines
388 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2013-02-05 14:16:51 -05:00
class InviteSerializer < ApplicationSerializer
attributes :email, :created_at, :redeemed_at, :expired, :user
2013-02-05 14:16:51 -05:00
def include_email?
!object.redeemed?
end
def expired
object.expired?
end
def user
ser = InvitedUserSerializer.new(object.user, scope: scope, root: false)
ser.invited_by = object.invited_by
ser.as_json
end
2013-02-05 14:16:51 -05:00
end