mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 19:34:09 +08:00
effbd6d3e4
This can happen if the topic to which a user is invited is in a private category and the user was not invited to one of the groups that can see that specific category. This used to be a warning and this commit makes it an error.
49 lines
985 B
Ruby
49 lines
985 B
Ruby
# frozen_string_literal: true
|
|
|
|
class InviteSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:invite_key,
|
|
:link,
|
|
:email,
|
|
:domain,
|
|
:emailed,
|
|
:max_redemptions_allowed,
|
|
:redemption_count,
|
|
:custom_message,
|
|
:created_at,
|
|
: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 include_custom_message?
|
|
email.present?
|
|
end
|
|
|
|
def include_max_redemptions_allowed?
|
|
email.blank?
|
|
end
|
|
|
|
def include_redemption_count?
|
|
email.blank?
|
|
end
|
|
|
|
def expired
|
|
object.expired?
|
|
end
|
|
end
|