discourse/app/serializers/invite_serializer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
413 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2013-02-06 03:16:51 +08:00
class InviteSerializer < ApplicationSerializer
attributes :email, :updated_at, :redeemed_at, :expired, :user
2013-02-06 03:16:51 +08:00
def include_email?
options[:show_emails] && !object.redeemed?
2013-02-06 03:16:51 +08:00
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-06 03:16:51 +08:00
end