mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
Add onboarding state selector for self-hosted signup (#251)
* Add onboarding modes to self-hosted signup * Style form consistently * Configure ONBOARDING_STATE via ENV
This commit is contained in:
@@ -26,7 +26,7 @@ class Settings::HostingsControllerTest < ActionDispatch::IntegrationTest
|
||||
get settings_hosting_url
|
||||
assert_response :forbidden
|
||||
|
||||
patch settings_hosting_url, params: { setting: { require_invite_for_signup: true } }
|
||||
patch settings_hosting_url, params: { setting: { onboarding_state: "invite_only" } }
|
||||
assert_response :forbidden
|
||||
end
|
||||
end
|
||||
@@ -48,6 +48,20 @@ class Settings::HostingsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test "can update onboarding state when self hosting is enabled" do
|
||||
with_self_hosting do
|
||||
patch settings_hosting_url, params: { setting: { onboarding_state: "invite_only" } }
|
||||
|
||||
assert_equal "invite_only", Setting.onboarding_state
|
||||
assert Setting.require_invite_for_signup
|
||||
|
||||
patch settings_hosting_url, params: { setting: { onboarding_state: "closed" } }
|
||||
|
||||
assert_equal "closed", Setting.onboarding_state
|
||||
refute Setting.require_invite_for_signup
|
||||
end
|
||||
end
|
||||
|
||||
test "can update openai access token when self hosting is enabled" do
|
||||
with_self_hosting do
|
||||
patch settings_hosting_url, params: { setting: { openai_access_token: "token" } }
|
||||
|
||||
@@ -44,7 +44,10 @@ class SettingsTest < ApplicationSystemTestCase
|
||||
click_link "Self-Hosting"
|
||||
assert_current_path settings_hosting_path
|
||||
assert_selector "h1", text: "Self-Hosting"
|
||||
check "setting[require_invite_for_signup]", allow_label_click: true
|
||||
find("select#setting_onboarding_state").select("Invite-only")
|
||||
within("select#setting_onboarding_state") do
|
||||
assert_selector "option[selected]", text: "Invite-only"
|
||||
end
|
||||
click_button "Generate new code"
|
||||
assert_selector 'span[data-clipboard-target="source"]', visible: true, count: 1 # invite code copy widget
|
||||
copy_button = find('button[data-action="clipboard#copy"]', match: :first) # Find the first copy button (adjust if needed)
|
||||
|
||||
Reference in New Issue
Block a user