mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
**Previously**, getting a second admin onto a site took many steps: create an invite, wait for the person to sign up, find their profile, grant admin, and confirm via email. **In this update**, a redesigned invite modal (gated behind the `enable_admin_invites` upcoming change) lets admins invite someone as an admin by email in one step. The invitee becomes a moderator on signup and an admin once the inviter confirms via the existing admin confirmation email. The admin onboarding panel's "Invite collaborators" step now opens this flow with the admin option preselected. | Invite members | Advanced options | Email delivery | | --- | --- | --- | |  |  |  | | Invite admins | Advanced options | Invite sent | | --- | --- | --- | |  |  |  | | Link created | Email invitation sent | Onboarding panel | | --- | --- | --- | |  |  |  |
98 lines
2.4 KiB
Ruby
Vendored
98 lines
2.4 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Modals
|
|
class CreateInviteWithRoles < PageObjects::Modals::Base
|
|
MODAL_SELECTOR = ".create-invite-with-roles-modal"
|
|
|
|
def modal
|
|
find(MODAL_SELECTOR)
|
|
end
|
|
|
|
def open?
|
|
has_css?(MODAL_SELECTOR)
|
|
end
|
|
|
|
def closed?
|
|
has_no_css?(MODAL_SELECTOR)
|
|
end
|
|
|
|
def form
|
|
PageObjects::Components::FormKit.new("#{MODAL_SELECTOR} .form-kit")
|
|
end
|
|
|
|
def has_role_toggle?
|
|
within(modal) { has_css?(".create-invite-with-roles-modal__role-toggle") }
|
|
end
|
|
|
|
def has_no_role_toggle?
|
|
within(modal) { has_no_css?(".create-invite-with-roles-modal__role-toggle") }
|
|
end
|
|
|
|
def selected_role
|
|
within(modal) do
|
|
find(".create-invite-with-roles-modal__role-toggle input:checked", visible: false)[:value]
|
|
end
|
|
end
|
|
|
|
def select_role(role)
|
|
within(modal) do
|
|
find(
|
|
".create-invite-with-roles-modal__role-toggle input[value='#{role}']",
|
|
visible: false,
|
|
).ancestor("label").click
|
|
end
|
|
end
|
|
|
|
def role_option_disabled?(role)
|
|
within(modal) do
|
|
find(
|
|
".create-invite-with-roles-modal__role-toggle input[value='#{role}']",
|
|
visible: false,
|
|
).disabled?
|
|
end
|
|
end
|
|
|
|
def select_delivery(delivery)
|
|
within(modal) do
|
|
find(
|
|
".create-invite-with-roles-modal__delivery input[value='#{delivery}']",
|
|
visible: false,
|
|
).ancestor("label").click
|
|
end
|
|
end
|
|
|
|
def save_button
|
|
within(modal) { find(".save-invite") }
|
|
end
|
|
|
|
def toggle_advanced_options
|
|
within(modal) { find(".toggle-advanced").click }
|
|
end
|
|
|
|
def edit_button
|
|
within(modal) { find(".edit-invite") }
|
|
end
|
|
|
|
def cancel_button
|
|
within(modal) { find(".cancel-button") }
|
|
end
|
|
|
|
def invite_link_input
|
|
within(modal) { find("input.invite-link") }
|
|
end
|
|
|
|
def has_summary?
|
|
within(modal) { has_css?(".create-invite-with-roles-modal__summary") }
|
|
end
|
|
|
|
def has_sent_to_message?(email)
|
|
within(modal) { has_css?(".create-invite-with-roles-modal__sent-to", text: email) }
|
|
end
|
|
|
|
def has_email_sent_confirmation?(email)
|
|
within(modal) { has_css?(".create-invite-with-roles-modal__email-sent", text: email) }
|
|
end
|
|
end
|
|
end
|
|
end
|