2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-05 08:59:27 +08:00

Let's not show tons of extra information about invites unless you're the

person who invited them.
This commit is contained in:
Robin Ward 2014-03-21 14:13:04 -04:00
parent e7ae0bba5f
commit 539890afdf
9 changed files with 89 additions and 50 deletions

View file

@ -1,7 +1,6 @@
class InviteSerializer < ApplicationSerializer
attributes :email, :created_at, :redeemed_at, :expired
has_one :user, embed: :objects, serializer: InvitedUserSerializer
attributes :email, :created_at, :redeemed_at, :expired, :user
def include_email?
!object.redeemed?
@ -11,4 +10,10 @@ class InviteSerializer < ApplicationSerializer
object.expired?
end
def user
ser = InvitedUserSerializer.new(object.user, scope: scope, root: false)
ser.invited_by = object.invited_by
ser.as_json
end
end