mirror of
https://github.com/discourse/discourse.git
synced 2024-12-13 10:23:45 +08:00
7f3240ea31
* FIX: Do not show expired invites under Pending tab * DEV: Controller action was renamed in previous commit * FEATURE: Add 'Expired' tab to invites * FEATURE: Refresh model after removing expired invites * FEATURE: Do not immediately add invite to the list Opening the 'create-invite' modal used to automatically generate an invite to reserve an invite link. If the user did not save it and closed the modal, the invite would be destroyed. This operations caused the invite list to change in the background and confuse users. * FEATURE: Sort redeemed users by creation time * UX: Improve show / hide advanced options link * FIX: Show redeemed users even if invites were trashed * UX: Change modal title when editing invite * UX: Remove Get Link button Users can get it from the edit modal * FEATURE: Add limit for invite links generated by regular users * FEATURE: Add option to skip email * UX: Show better error messages * FIX: Show "Invited by" even if invite was trashed Follow up to 1fdfa13a099d8e46edd0c481b3aaaafe40455ced. * FEATURE: Add button to save without sending email Follow up to c86379a465f28a3cc64a4a8c939cf32cf2931659. * DEV: Use a buffer to hold all changed data * FEATURE: Close modal after save * FEATURE: Rate limit resend invite email * FEATURE: Make the save buttons smarter * FEATURE: Do not always send email even for new invites
24 lines
559 B
Ruby
24 lines
559 B
Ruby
# frozen_string_literal: true
|
|
|
|
class InvitedSerializer < ApplicationSerializer
|
|
attributes :invites, :can_see_invite_details, :counts
|
|
|
|
def invites
|
|
ActiveModel::ArraySerializer.new(
|
|
object.invite_list,
|
|
each_serializer: object.type == "pending" || object.type == "expired" ? InviteSerializer : InvitedUserSerializer,
|
|
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 counts
|
|
object.counts
|
|
end
|
|
end
|