mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:20:43 +08:00
e8fad7a69e
* DEV: changes so plugins can customize invites UI Co-Authored-By: Robin Ward <robin.ward@gmail.com>
23 lines
520 B
Ruby
23 lines
520 B
Ruby
# frozen_string_literal: true
|
|
|
|
class InvitedSerializer < ApplicationSerializer
|
|
attributes :invites, :can_see_invite_details
|
|
|
|
def invites
|
|
ActiveModel::ArraySerializer.new(
|
|
object.invite_list,
|
|
scope: scope,
|
|
root: false,
|
|
show_emails: object.show_emails
|
|
).as_json
|
|
end
|
|
|
|
def can_see_invite_details
|
|
scope.can_see_invite_details?(object.inviter)
|
|
end
|
|
|
|
def read_attribute_for_serialization(attr)
|
|
object.respond_to?(attr) ? object.public_send(attr) : public_send(attr)
|
|
end
|
|
end
|