2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
class InviteSerializer < ApplicationSerializer
|
2021-03-03 17:45:29 +08:00
|
|
|
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
|
2013-02-06 03:16:51 +08:00
|
|
|
|
|
|
|
def include_email?
|
2020-03-05 00:47:09 +08:00
|
|
|
options[:show_emails] && !object.redeemed?
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|
|
|
|
|
2014-01-22 04:13:55 +08:00
|
|
|
def expired
|
|
|
|
object.expired?
|
|
|
|
end
|
2013-02-06 03:16:51 +08:00
|
|
|
end
|