discourse/app/serializers/invite_serializer.rb
Dan Ungureanu c047640ad4
FEATURE: Various improvements to invite system (#12023)
The user interface has been reorganized to show email and link invites
in the same screen. Staff has more control over creating and updating
invites. Bulk invite has also been improved with better explanations.

On the server side, many code paths for email and link invites have
been merged to avoid duplicated logic. The API returns better responses
with more appropriate HTTP status codes.
2021-03-03 11:45:29 +02:00

25 lines
571 B
Ruby

# frozen_string_literal: true
class InviteSerializer < ApplicationSerializer
attributes :id,
:link,
:email,
:redemption_count,
:max_redemptions_allowed,
:custom_message,
:updated_at,
:expires_at,
:expired
has_many :topics, embed: :object, serializer: BasicTopicSerializer
has_many :groups, embed: :object, serializer: BasicGroupSerializer
def include_email?
options[:show_emails] && !object.redeemed?
end
def expired
object.expired?
end
end