discourse/app/serializers/invite_serializer.rb
Dan Ungureanu 687e09c885
UX: Minor improvements to invites (#12324)
* FIX: Show resend button only if an email was sent

Otherwise, show the "save and send email" button.

* UX: Copy change

* UX: Show feedback when link was copied
2021-03-09 16:56:18 +02:00

34 lines
736 B
Ruby

# frozen_string_literal: true
class InviteSerializer < ApplicationSerializer
attributes :id,
:link,
:email,
:emailed,
: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 include_emailed?
email.present?
end
def emailed
object.emailed_status != Invite.emailed_status_types[:not_required]
end
def expired
object.expired?
end
end